prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  sync_stores/update_stores
  For 2.9.0 we're making Pootle FS the main path into Pootle, but `sync_stores` and `update_stores` are kept for backward compatibility.
  
  But we have situations where Pootle FS can't do what sync/update does in that it may do more or may touch the db/file when sync/update would only do it on one side.
  
  So we need to warn:
  1. That this mode is deprecated
  2. Where there are conflicts e.g. we should warn and bail or warn and allow it to continue
  
  Essentially, we want people to know when we can't do what they expect.
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `pootle/apps/pootle_app/management/commands/sync_stores.py`
  Content:
  ```
  1 # -*- coding: utf-8 -*-
  2 #
  3 # Copyright (C) Pootle contributors.
  4 #
  5 # This file is a part of the Pootle project. It is distributed under the GPL3
  6 # or later license. See the LICENSE file for a copy of the license and the
  7 # AUTHORS file for copyright and authorship information.
  8 
  9 import os
  10 os.environ['DJANGO_SETTINGS_MODULE'] = 'pootle.settings'
  11 
  12 from pootle_app.management.commands import PootleCommand
  13 from pootle_fs.utils import FSPlugin
  14 
  15 
  16 class Command(PootleCommand):
  17     help = "Save new translations to disk manually."
  18     process_disabled_projects = True
  19 
  20     def add_arguments(self, parser):
  21         super(Command, self).add_arguments(parser)
  22         parser.add_argument(
  23             '--overwrite',
  24             action='store_true',
  25             dest='overwrite',
  26             default=False,
  27             help="Don't just save translations, but "
  28                  "overwrite files to reflect state in database",
  29         )
  30         parser.add_argument(
  31             '--skip-missing',
  32             action='store_true',
  33             dest='skip_missing',
  34             default=False,
  35             help="Ignore missing files on disk",
  36         )
  37         parser.add_argument(
  38             '--force',
  39             action='store_true',
  40             dest='force',
  41             default=False,
  42             help="Don't ignore stores synced after last change",
  43         )
  44 
  45     def handle_all_stores(self, translation_project, **options):
  46         path_glob = "%s*" % translation_project.pootle_path
  47         plugin = FSPlugin(translation_project.project)
  48         plugin.fetch()
  49         if not options["skip_missing"]:
  50             plugin.add(pootle_path=path_glob, update="fs")
  51         if options["overwrite"]:
  52             plugin.resolve(
  53                 pootle_path=path_glob,
  54                 pootle_wins=True)
  55         plugin.sync(pootle_path=path_glob, update="fs")
  56         if options["force"]:
  57             # touch the timestamps on disk for files that
  58             # werent updated
  59             pass
  60
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/pootle/apps/pootle_app/management/commands/sync_stores.py b/pootle/apps/pootle_app/management/commands/sync_stores.py
  --- a/pootle/apps/pootle_app/management/commands/sync_stores.py
  +++ b/pootle/apps/pootle_app/management/commands/sync_stores.py
  @@ -6,6 +6,7 @@
   # or later license. See the LICENSE file for a copy of the license and the
   # AUTHORS file for copyright and authorship information.
   
  +import logging
   import os
   os.environ['DJANGO_SETTINGS_MODULE'] = 'pootle.settings'
   
  @@ -13,6 +14,9 @@
   from pootle_fs.utils import FSPlugin
   
   
  +logger = logging.getLogger(__name__)
  +
  +
   class Command(PootleCommand):
       help = "Save new translations to disk manually."
       process_disabled_projects = True
  @@ -42,10 +46,22 @@
               help="Don't ignore stores synced after last change",
           )
   
  +    warn_on_conflict = []
  +
       def handle_all_stores(self, translation_project, **options):
           path_glob = "%s*" % translation_project.pootle_path
           plugin = FSPlugin(translation_project.project)
           plugin.fetch()
  +        if translation_project.project.pk not in self.warn_on_conflict:
  +            state = plugin.state()
  +            if any(k in state for k in ["conflict", "conflict_untracked"]):
  +                logger.warn(
  +                    "The project '%s' has conflicting changes in the database "
  +                    "and translation files. Use `pootle fs resolve` to tell "
  +                    "pootle how to merge",
  +                    translation_project.project.code)
  +                self.warn_on_conflict.append(
  +                    translation_project.project.pk)
           if not options["skip_missing"]:
               plugin.add(pootle_path=path_glob, update="fs")
           if options["overwrite"]:
  
verification_info: {"golden_diff": "diff --git a/pootle/apps/pootle_app/management/commands/sync_stores.py b/pootle/apps/pootle_app/management/commands/sync_stores.py\n--- a/pootle/apps/pootle_app/management/commands/sync_stores.py\n+++ b/pootle/apps/pootle_app/management/commands/sync_stores.py\n@@ -6,6 +6,7 @@\n # or later license. See the LICENSE file for a copy of the license and the\n # AUTHORS file for copyright and authorship information.\n \n+import logging\n import os\n os.environ['DJANGO_SETTINGS_MODULE'] = 'pootle.settings'\n \n@@ -13,6 +14,9 @@\n from pootle_fs.utils import FSPlugin\n \n \n+logger = logging.getLogger(__name__)\n+\n+\n class Command(PootleCommand):\n     help = \"Save new translations to disk manually.\"\n     process_disabled_projects = True\n@@ -42,10 +46,22 @@\n             help=\"Don't ignore stores synced after last change\",\n         )\n \n+    warn_on_conflict = []\n+\n     def handle_all_stores(self, translation_project, **options):\n         path_glob = \"%s*\" % translation_project.pootle_path\n         plugin = FSPlugin(translation_project.project)\n         plugin.fetch()\n+        if translation_project.project.pk not in self.warn_on_conflict:\n+            state = plugin.state()\n+            if any(k in state for k in [\"conflict\", \"conflict_untracked\"]):\n+                logger.warn(\n+                    \"The project '%s' has conflicting changes in the database \"\n+                    \"and translation files. Use `pootle fs resolve` to tell \"\n+                    \"pootle how to merge\",\n+                    translation_project.project.code)\n+                self.warn_on_conflict.append(\n+                    translation_project.project.pk)\n         if not options[\"skip_missing\"]:\n             plugin.add(pootle_path=path_glob, update=\"fs\")\n         if options[\"overwrite\"]:\n", "issue": "sync_stores/update_stores\nFor 2.9.0 we're making Pootle FS the main path into Pootle, but `sync_stores` and `update_stores` are kept for backward compatibility.\r\n\r\nBut we have situations where Pootle FS can't do what sync/update does in that it may do more or may touch the db/file when sync/update would only do it on one side.\r\n\r\nSo we need to warn:\r\n1. That this mode is deprecated\r\n2. Where there are conflicts e.g. we should warn and bail or warn and allow it to continue\r\n\r\nEssentially, we want people to know when we can't do what they expect.\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n#\n# Copyright (C) Pootle contributors.\n#\n# This file is a part of the Pootle project. It is distributed under the GPL3\n# or later license. See the LICENSE file for a copy of the license and the\n# AUTHORS file for copyright and authorship information.\n\nimport os\nos.environ['DJANGO_SETTINGS_MODULE'] = 'pootle.settings'\n\nfrom pootle_app.management.commands import PootleCommand\nfrom pootle_fs.utils import FSPlugin\n\n\nclass Command(PootleCommand):\n    help = \"Save new translations to disk manually.\"\n    process_disabled_projects = True\n\n    def add_arguments(self, parser):\n        super(Command, self).add_arguments(parser)\n        parser.add_argument(\n            '--overwrite',\n            action='store_true',\n            dest='overwrite',\n            default=False,\n            help=\"Don't just save translations, but \"\n                 \"overwrite files to reflect state in database\",\n        )\n        parser.add_argument(\n            '--skip-missing',\n            action='store_true',\n            dest='skip_missing',\n            default=False,\n            help=\"Ignore missing files on disk\",\n        )\n        parser.add_argument(\n            '--force',\n            action='store_true',\n            dest='force',\n            default=False,\n            help=\"Don't ignore stores synced after last change\",\n        )\n\n    def handle_all_stores(self, translation_project, **options):\n        path_glob = \"%s*\" % translation_project.pootle_path\n        plugin = FSPlugin(translation_project.project)\n        plugin.fetch()\n        if not options[\"skip_missing\"]:\n            plugin.add(pootle_path=path_glob, update=\"fs\")\n        if options[\"overwrite\"]:\n            plugin.resolve(\n                pootle_path=path_glob,\n                pootle_wins=True)\n        plugin.sync(pootle_path=path_glob, update=\"fs\")\n        if options[\"force\"]:\n            # touch the timestamps on disk for files that\n            # werent updated\n            pass\n", "path": "pootle/apps/pootle_app/management/commands/sync_stores.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\n#\n# Copyright (C) Pootle contributors.\n#\n# This file is a part of the Pootle project. It is distributed under the GPL3\n# or later license. See the LICENSE file for a copy of the license and the\n# AUTHORS file for copyright and authorship information.\n\nimport logging\nimport os\nos.environ['DJANGO_SETTINGS_MODULE'] = 'pootle.settings'\n\nfrom pootle_app.management.commands import PootleCommand\nfrom pootle_fs.utils import FSPlugin\n\n\nlogger = logging.getLogger(__name__)\n\n\nclass Command(PootleCommand):\n    help = \"Save new translations to disk manually.\"\n    process_disabled_projects = True\n\n    def add_arguments(self, parser):\n        super(Command, self).add_arguments(parser)\n        parser.add_argument(\n            '--overwrite',\n            action='store_true',\n            dest='overwrite',\n            default=False,\n            help=\"Don't just save translations, but \"\n                 \"overwrite files to reflect state in database\",\n        )\n        parser.add_argument(\n            '--skip-missing',\n            action='store_true',\n            dest='skip_missing',\n            default=False,\n            help=\"Ignore missing files on disk\",\n        )\n        parser.add_argument(\n            '--force',\n            action='store_true',\n            dest='force',\n            default=False,\n            help=\"Don't ignore stores synced after last change\",\n        )\n\n    warn_on_conflict = []\n\n    def handle_all_stores(self, translation_project, **options):\n        path_glob = \"%s*\" % translation_project.pootle_path\n        plugin = FSPlugin(translation_project.project)\n        plugin.fetch()\n        if translation_project.project.pk not in self.warn_on_conflict:\n            state = plugin.state()\n            if any(k in state for k in [\"conflict\", \"conflict_untracked\"]):\n                logger.warn(\n                    \"The project '%s' has conflicting changes in the database \"\n                    \"and translation files. Use `pootle fs resolve` to tell \"\n                    \"pootle how to merge\",\n                    translation_project.project.code)\n                self.warn_on_conflict.append(\n                    translation_project.project.pk)\n        if not options[\"skip_missing\"]:\n            plugin.add(pootle_path=path_glob, update=\"fs\")\n        if options[\"overwrite\"]:\n            plugin.resolve(\n                pootle_path=path_glob,\n                pootle_wins=True)\n        plugin.sync(pootle_path=path_glob, update=\"fs\")\n        if options[\"force\"]:\n            # touch the timestamps on disk for files that\n            # werent updated\n            pass\n", "path": "pootle/apps/pootle_app/management/commands/sync_stores.py"}]}