{"action":"created","comment":{"url":"https://api.github.com/repos/shotgunsoftware/tk-core/pulls/comments/26548842","id":26548842,"diff_hunk":"@@ -0,0 +1,311 @@\n+# Copyright (c) 2013 Shotgun Software Inc.\n+# \n+# CONFIDENTIAL AND PROPRIETARY\n+# \n+# This work is provided \"AS IS\" and subject to the Shotgun Pipeline Toolkit \n+# Source Code License included in this distribution package. See LICENSE.\n+# By accessing, using, copying or modifying this work you indicate your \n+# agreement to the Shotgun Pipeline Toolkit Source Code License. All rights \n+# not expressly granted therein are reserved by Shotgun Software Inc.\n+\n+\"\"\"\n+Method to unregister folders from the path cache\n+\"\"\"\n+\n+from ...errors import TankError\n+from ... import path_cache\n+from .action_base import Action\n+from ...util.login import get_current_user \n+\n+class UnregisterFoldersAction(Action):\n+    \"\"\"\n+    Tank command for unregistering a folder on disk from Shotgun. This is part of the process of\n+    the deletion of a folder on disk. As part of removing or moving, the folder needs to be \n+    unregistered with Shotgun to ensure that the connection between that path and the related \n+    entity is undone.\n+    \"\"\"\n+    \n+    def __init__(self):\n+        \"\"\"\n+        Constructor\n+        \"\"\"        \n+        Action.__init__(self, \n+                        \"unregister_folders\", \n+                        Action.TK_INSTANCE, \n+                        (\"Unregisters the folders for an object in Shotgun.\"), \n+                        \"Admin\")\n+        \n+        # this method can be executed via the API\n+        self.supports_api = True\n+\n+        self.parameters = {}\n+        \n+        self.parameters[\"path\"] = { \"description\": \"Path to unregister. Any child paths will be unregistered too.\",\n+                                    \"default\": None,\n+                                    \"type\": \"str\" }\n+        \n+        self.parameters[\"entity\"] = { \"description\": (\"Entity to unregister. Should be a Shotgun style entity \"\n+                                                      \"dictionary with keys type and id.\"),\n+                                      \"default\": None,\n+                                      \"type\": \"dict\" }\n+        \n+    \n+    def run_interactive(self, log, args):\n+        \"\"\"\n+        Tank command accessor\n+        \"\"\"\n+        \n+        if not self.tk.pipeline_configuration.get_shotgun_path_cache_enabled():            \n+            # remote cache not turned on for this project\n+            log.error(\"Looks like this project doesn't synchronize its folders with Shotgun! \"\n+                      \"If you want to turn on synchronization for this project, run \"\n+                      \"the 'upgrade_folders' tank command.\")\n+            return\n+        \n+        # there are multiple syntaxes for this command\n+        # - context based: tank Shot ABC123 unregister_folders\n+        # - path based: tank unregister_folders path1, path2, path3\n+        \n+        if self.context.entity:\n+            # context based - e.g. 'tank Shot ABC123 unregister_folders' \n+            self._unregister_entity(self.context.entity, log, prompt=True)\n+        \n+        else:\n+            # no context - so it is path based instead \n+            if len(args) == 0:\n+                # display help message\n+                \n+                log.info(\"This command is used to unregister folders that have been created via the Toolkit \"\n+                         \"folder creation. When applications are launched and folders are created, new entries \"\n+                         \"are added to the Shotgun FilesystemLocation table. These are then used to track the \"\n+                         \"relationship between Shotgun objects and folders on disk. If you ever need to \"\n+                         \"undo these associations, you can use this command. \")\n+                log.info(\"\")\n+                log.info(\"You can use it by passing a Shotgun object, e.g.\")\n+                log.info(\"> tank Shot ABC123 unregister_folders\")\n+                log.info(\"\")\n+                log.info(\"Alternatively, you can use it by passing one or more paths, e.g.\")\n+                log.info(\"> tank unregister_folders /path/to/folder_a /path/to/folder_b\")\n+                log.info(\"\")\n+                \n+            else:\n+                paths = args\n+                log.info(\"Will process the following folders:\")\n+                for p in paths:\n+                    log.info(\" - %s\" % p)\n+                log.info(\"\")\n+                self._unregister_paths(paths, log, prompt=True)\n+        \n+        \n+    def run_noninteractive(self, log, parameters):\n+        \"\"\"\n+        API accessor\n+        \n+        :param log: Std logging object\n+        :param parameters: Std tank command parameters dict\n+        :returns: List of dictionaries to represents the items that were unregistered.\n+                  Each dictionary has keys path and sg_id.\n+                  Note that the shotgun ids returned will refer to retired objects in \n+                  Shotgun rather than live ones.\n+        \"\"\"\n+        # validate params and seed default values\n+        computed_params = self._validate_parameters(parameters) \n+        \n+        # must have a path or an entity\n+        if computed_params[\"path\"] is None and computed_params[\"entity\"] is None:\n+            raise TankError(\"Must either specify a path or an entity!\")\n+        # ... but not both\n+        if computed_params[\"path\"] and computed_params[\"entity\"]:\n+            raise TankError(\"Cannot specify both a path and an entity!\")\n+            \n+        if computed_params[\"path\"]:\n+            path = computed_params[\"path\"]\n+            return self._unregister_paths([path], log, prompt=False)\n+        \n+        if computed_params[\"entity\"]:\n+            entity = computed_params[\"entity\"]\n+            if \"id\" not in entity:\n+                raise TankError(\"Entity dictionary does not contain an id key!\")\n+            if \"type\" not in entity:\n+                raise TankError(\"Entity dictionary does not contain a type key!\")\n+            return self._unregister_entity(entity, log, prompt=False)\n+            \n+\n+    def _unregister_paths(self, paths, log, prompt):\n+        \"\"\"\n+        Unregisters a path.\n+        \n+        :returns: List of dictionaries to represents the items that were unregistered.\n+                  Each dictionary has keys path and sg_id.\n+                  Note that the shotgun ids returned will refer to retired objects in \n+                  Shotgun rather than live ones.\n+        \"\"\"\n+        log.debug(\"Will unregister folders for the following root paths:\")\n+        for p in paths:\n+            log.debug(p)\n+        \n+        # first of all, make sure we are up to date.\n+        pc = path_cache.PathCache(self.tk)\n+        try:\n+            pc.synchronize(log)\n+\n+            fs_location_ids = set()\n+            for p in paths:\n+                sg_id = pc.get_shotgun_id_from_path(p)\n+                if sg_id is None:\n+                    log.warning(\"Path '%s' is not registered in Shotgun - ignoring.\" % p)\n+                else:\n+                    log.debug(\"The path '%s' is matching filesystem location id %s\" % (p, sg_id))\n+                    fs_location_ids.add(sg_id)\n+\n+        finally:\n+            pc.close()\n+        \n+        if len(fs_location_ids) == 0:\n+            log.info(\"\")\n+            log.info(\"No valid paths found!\")\n+            return []\n+        \n+        return self._unregister_filesystem_location_ids(list(fs_location_ids), log, prompt)                              \n+\n+    \n+    def _unregister_entity(self, entity, log, prompt):\n+        \"\"\"\n+        Unregisters an entity from the path cache in Shotgun.\n+        \n+        :param entity: Shotgun entity dict (e.g Shot or Asset) with keys type and id\n+        :param log: Logger\n+        :param prompt: If true, the command may prompt the user for confirmation\n+        :returns: List of dictionaries to represents the items that were unregistered.\n+                  Each dictionary has keys path and sg_id.\n+                  Note that the shotgun ids returned will refer to retired objects in \n+                  Shotgun rather than live ones.\n+        \"\"\"\n+        log.debug(\"Unregister folders for Shotgun Entity %s...\" % entity)\n+    \n+        # first of all, make sure we are up to date.\n+        pc = path_cache.PathCache(self.tk)\n+        try:\n+            pc.synchronize(log)\n+        finally:\n+            pc.close()\n+\n+        # get the filesystem location ids which are associated with the entity    \n+        sg_data = self.tk.shotgun.find(path_cache.SHOTGUN_ENTITY, [[path_cache.SG_ENTITY_FIELD, \"is\", entity]])\n+        sg_ids = [x[\"id\"] for x in sg_data]\n+        log.debug(\"The following path cache ids are linked to the entity: %s\" % sg_ids)\n+        \n+        if len(sg_ids) == 0:\n+            log.info(\"This entity does not have any folder associated!\")\n+            return []\n+        \n+        return self._unregister_filesystem_location_ids(sg_ids, log, prompt)                              \n+        \n+        \n+    def _unregister_filesystem_location_ids(self, ids, log, prompt):\n+        \"\"\"\n+        Performs the unregistration of a path from the path cache database.\n+        Will recursively unregister any child items parented to the given\n+        filesystem location id.\n+        \n+        :param ids: List of filesystem location ids to unregister\n+        :param prompt: Should the user be presented with confirmation prompts?\n+        :param log: Logging instance\n+        :returns: List of dictionaries to represents the items that were unregistered.\n+                  Each dictionary has keys path and sg_id.\n+                  Note that the shotgun ids returned will refer to retired objects in \n+                  Shotgun rather than live ones.\n+        \"\"\"\n+        # now use the path cache to get a list of all folders (recursively) that are\n+        # linked up to the folders registered for this entity.\n+        \n+        paths = []\n+        pc = path_cache.PathCache(self.tk)\n+        try:\n+            for sg_fs_id in ids:\n+                paths.extend(pc.get_folder_tree_from_sg_id(sg_fs_id))\n+        finally:\n+            pc.close()\n+                \n+        log.info(\"\")\n+        log.info(\"The following folders will be unregistered:\")\n+        for p in paths:\n+            log.info(\" - %s\" % p[\"path\"])\n+        \n+        log.info(\"\")\n+        log.info(\"Proceeding would unregister the above paths from Toolkit's folder database. \"\n+                 \"This will not alter any of the content in the file system, but once you have \"\n+                 \"unregistered the paths, they will not be recognized by Shotgun.\")\n+        log.info(\"\")\n+        log.info(\"This is useful if you for example have renamed an Asset or Shot and want to \"\n+                 \"move the data around on disk. In this case, start by unregistering the existing \"\n+                 \"folder entries in Shotgun, then rename the Shot or Asset in Shotgun. Next, \"\n+                 \"create new folders on disk using Toolkit's 'create folders' command and lastly \"\n+                 \"move all your file system data across from the old location to the new location.\")\n+        log.info(\"\")\n+        if prompt:\n+            val = raw_input(\"Proceed with unregister? (Yes/No) ? [Yes]: \")\n+            if val != \"\" and not val.lower().startswith(\"y\"):\n+                log.info(\"Exiting! Nothing was unregistered.\")\n+                return []\n+        \n+        log.info(\"Removing items from Shotgun....\")","path":"python/tank/deploy/tank_commands/unregister_folders.py","position":252,"original_position":252,"commit_id":"4781b32e67a4526dbcf3fc801cb0bc5badcfc618","original_commit_id":"4781b32e67a4526dbcf3fc801cb0bc5badcfc618","user":{"login":"kporangehat","id":3391,"avatar_url":"https://avatars.githubusercontent.com/u/3391?v=3","gravatar_id":"","url":"https://api.github.com/users/kporangehat","html_url":"https://github.com/kporangehat","followers_url":"https://api.github.com/users/kporangehat/followers","following_url":"https://api.github.com/users/kporangehat/following{/other_user}","gists_url":"https://api.github.com/users/kporangehat/gists{/gist_id}","starred_url":"https://api.github.com/users/kporangehat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kporangehat/subscriptions","organizations_url":"https://api.github.com/users/kporangehat/orgs","repos_url":"https://api.github.com/users/kporangehat/repos","events_url":"https://api.github.com/users/kporangehat/events{/privacy}","received_events_url":"https://api.github.com/users/kporangehat/received_events","type":"User","site_admin":false},"body":"> Unregistering folders from Shotgun...","created_at":"2015-03-17T04:32:15Z","updated_at":"2015-03-17T04:32:15Z","html_url":"https://github.com/shotgunsoftware/tk-core/pull/139#discussion_r26548842","pull_request_url":"https://api.github.com/repos/shotgunsoftware/tk-core/pulls/139","_links":{"self":{"href":"https://api.github.com/repos/shotgunsoftware/tk-core/pulls/comments/26548842"},"html":{"href":"https://github.com/shotgunsoftware/tk-core/pull/139#discussion_r26548842"},"pull_request":{"href":"https://api.github.com/repos/shotgunsoftware/tk-core/pulls/139"}}},"pull_request":{"url":"https://api.github.com/repos/shotgunsoftware/tk-core/pulls/139","id":30897619,"html_url":"https://github.com/shotgunsoftware/tk-core/pull/139","diff_url":"https://github.com/shotgunsoftware/tk-core/pull/139.diff","patch_url":"https://github.com/shotgunsoftware/tk-core/pull/139.patch","issue_url":"https://api.github.com/repos/shotgunsoftware/tk-core/issues/139","number":139,"state":"open","locked":false,"title":"#28350 Improved unregister folders support","user":{"login":"manneohrstrom","id":337710,"avatar_url":"https://avatars.githubusercontent.com/u/337710?v=3","gravatar_id":"","url":"https://api.github.com/users/manneohrstrom","html_url":"https://github.com/manneohrstrom","followers_url":"https://api.github.com/users/manneohrstrom/followers","following_url":"https://api.github.com/users/manneohrstrom/following{/other_user}","gists_url":"https://api.github.com/users/manneohrstrom/gists{/gist_id}","starred_url":"https://api.github.com/users/manneohrstrom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/manneohrstrom/subscriptions","organizations_url":"https://api.github.com/users/manneohrstrom/orgs","repos_url":"https://api.github.com/users/manneohrstrom/repos","events_url":"https://api.github.com/users/manneohrstrom/events{/privacy}","received_events_url":"https://api.github.com/users/manneohrstrom/received_events","type":"User","site_admin":false},"body":"Several new syntaxes are available for the tank unregister_folders command.\r\n\r\nFirst, the existing form:\r\n\r\n```\r\nMannes-MacBook-Pro-2:climp manne$ ./tank Shot 1660 unregister_folders\r\n\r\nWelcome to the Shotgun Pipeline Toolkit!\r\nFor documentation, see https://toolkit.shotgunsoftware.com\r\n- You are running a project specific tank command. Only items that are part of\r\nthis project will be considered.\r\n- Did not find a Shot named '1660', will look for a Shot with id 1660 instead.\r\n- Using configuration 'Primary' and Core HEAD\r\n- Setting the Context to Shot aaa_00010.\r\n- Running command unregister_folders...\r\n\r\n\r\n----------------------------------------------------------------------\r\nCommand: Unregister folders\r\n----------------------------------------------------------------------\r\n\r\n\r\nThe following folders will be unregistered:\r\n - /mnt/projects/climp/sequences/aaa/aaa_00010\r\n - /mnt/projects/climp/sequences/aaa/aaa_00010/Anm\r\n - /mnt/projects/climp/sequences/aaa/aaa_00010/Comp\r\n - /mnt/projects/climp/sequences/aaa/aaa_00010/FX\r\n - /mnt/projects/climp/sequences/aaa/aaa_00010/Lay\r\n - /mnt/projects/climp/sequences/aaa/aaa_00010/Light\r\n\r\nProceeding would unregister the above paths from Toolkit's folder database.\r\nThis will not alter any of the content in the file system, but once you have\r\nunregistered the paths, they will not be recognized by Shotgun.\r\n\r\nThis is useful if you for example have renamed an Asset or Shot and want to\r\nmove the data around on disk. In this case, start by unregistering the\r\nexisting folder entries in Shotgun, then rename the Shot or Asset in Shotgun.\r\nNext, create new folders on disk using Toolkit's 'create folders' command and\r\nlastly move all your file system data across from the old location to the new\r\nlocation.\r\n\r\nProceed with unregister? (Yes/No) ? [Yes]: \r\n```\r\n\r\nIn addition to this, if you run it from the project location, you now get a help blurb (@kporangehat, feedback on copy appreciated!)\r\n\r\n```\r\nMannes-MacBook-Pro-2:climp manne$ ./tank unregister_folders \r\n\r\nWelcome to the Shotgun Pipeline Toolkit!\r\nFor documentation, see https://toolkit.shotgunsoftware.com\r\nStarting Toolkit for your current path '/mnt/software/shotgun/climp'\r\n- The path is not associated with any Shotgun object.\r\n- Falling back on default project settings.\r\n- Using configuration 'Primary' and Core HEAD\r\n- Setting the Context to Climp.\r\n- Running command unregister_folders...\r\n\r\n\r\n----------------------------------------------------------------------\r\nCommand: Unregister folders\r\n----------------------------------------------------------------------\r\n\r\nThis command is used to unregister folders that have been created via the\r\nToolkit folder creation. When applications are launched and folders are\r\ncreated, new entries are added to the Shotgun FilesystemLocation table. These\r\nare then used to track the relationship between Shotgun objects and folders on\r\ndisk. If you ever need to undo these associations, you can use this command.\r\n\r\nYou can use it by passing a Shotgun object, e.g.\r\n> tank Shot ABC123 unregister_folders\r\n\r\nAlternatively, you can use it by passing one or more paths, e.g.\r\n> tank unregister_folders /path/to/folder_a /path/to/folder_b\r\n```\r\n\r\nYou can pass a path:\r\n\r\n```\r\nMannes-MacBook-Pro-2:climp manne$ ./tank unregister_folders /mnt/projects/climp/sequences/aaa/aaa_00010\r\n\r\nWelcome to the Shotgun Pipeline Toolkit!\r\nFor documentation, see https://toolkit.shotgunsoftware.com\r\nStarting toolkit for path '/mnt/software/shotgun/climp'\r\n- The path is not associated with any Shotgun object.\r\n- Falling back on default project settings.\r\n- Using configuration 'Primary' and Core HEAD\r\n- Setting the Context to Climp.\r\n- Running command unregister_folders...\r\n\r\n\r\n----------------------------------------------------------------------\r\nCommand: Unregister folders\r\n----------------------------------------------------------------------\r\n\r\nWill process the following folders:\r\n - /mnt/projects/climp/sequences/aaa/aaa_00010\r\n\r\n\r\nThe following folders will be unregistered:\r\n - /mnt/projects/climp/sequences/aaa/aaa_00010\r\n - /mnt/projects/climp/sequences/aaa/aaa_00010/Anm\r\n - /mnt/projects/climp/sequences/aaa/aaa_00010/Comp\r\n - /mnt/projects/climp/sequences/aaa/aaa_00010/FX\r\n - /mnt/projects/climp/sequences/aaa/aaa_00010/Lay\r\n - /mnt/projects/climp/sequences/aaa/aaa_00010/Light\r\n\r\nProceeding would unregister the above paths from Toolkit's folder database.\r\nThis will not alter any of the content in the file system, but once you have\r\nunregistered the paths, they will not be recognized by Shotgun.\r\n\r\nThis is useful if you for example have renamed an Asset or Shot and want to\r\nmove the data around on disk. In this case, start by unregistering the\r\nexisting folder entries in Shotgun, then rename the Shot or Asset in Shotgun.\r\nNext, create new folders on disk using Toolkit's 'create folders' command and\r\nlastly move all your file system data across from the old location to the new\r\nlocation.\r\n\r\nProceed with unregister? (Yes/No) ? [Yes]: \r\n```\r\n\r\nOr you can pass several paths:\r\n\r\n```\r\nMannes-MacBook-Pro-2:climp manne$ ./tank unregister_folders /mnt/projects/climp/sequences/aaa/aaa_00010 /mnt/projects/climp/sequences/aaa /mnt/projects/climp/sequences/aaa /foo/bar\r\n\r\nWelcome to the Shotgun Pipeline Toolkit!\r\nFor documentation, see https://toolkit.shotgunsoftware.com\r\nStarting toolkit for path '/mnt/software/shotgun/climp'\r\n- The path is not associated with any Shotgun object.\r\n- Falling back on default project settings.\r\n- Using configuration 'Primary' and Core HEAD\r\n- Setting the Context to Climp.\r\n- Running command unregister_folders...\r\n\r\n\r\n----------------------------------------------------------------------\r\nCommand: Unregister folders\r\n----------------------------------------------------------------------\r\n\r\nWill process the following folders:\r\n - /mnt/projects/climp/sequences/aaa/aaa_00010\r\n - /mnt/projects/climp/sequences/aaa\r\n - /mnt/projects/climp/sequences/aaa\r\n - /foo/bar\r\n\r\nWARNING: Path '/foo/bar' is not registered in Shotgun - ignoring.\r\n\r\nThe following folders will be unregistered:\r\n - /mnt/projects/climp/sequences/aaa\r\n - /mnt/projects/climp/sequences/aaa/aaa_00010\r\n - /mnt/projects/climp/sequences/aaa/aaa_00010/Anm\r\n - /mnt/projects/climp/sequences/aaa/aaa_00010/Comp\r\n - /mnt/projects/climp/sequences/aaa/aaa_00010/FX\r\n - /mnt/projects/climp/sequences/aaa/aaa_00010/Lay\r\n - /mnt/projects/climp/sequences/aaa/aaa_00010/Light\r\n - /mnt/projects/climp/sequences/aaa/aaa_00020\r\n - /mnt/projects/climp/sequences/aaa/aaa_00020/Anm\r\n - /mnt/projects/climp/sequences/aaa/aaa_00020/Comp\r\n - /mnt/projects/climp/sequences/aaa/aaa_00020/FX\r\n - /mnt/projects/climp/sequences/aaa/aaa_00020/Lay\r\n - /mnt/projects/climp/sequences/aaa/aaa_00020/Light\r\n - /mnt/projects/climp/sequences/aaa/aaa_00030\r\n - /mnt/projects/climp/sequences/aaa/aaa_00030/Anm\r\n - /mnt/projects/climp/sequences/aaa/aaa_00030/Comp\r\n - /mnt/projects/climp/sequences/aaa/aaa_00030/FX\r\n - /mnt/projects/climp/sequences/aaa/aaa_00030/Lay\r\n - /mnt/projects/climp/sequences/aaa/aaa_00030/Light\r\n - /mnt/projects/climp/sequences/aaa/aaa_00010\r\n - /mnt/projects/climp/sequences/aaa/aaa_00010/Anm\r\n - /mnt/projects/climp/sequences/aaa/aaa_00010/Comp\r\n - /mnt/projects/climp/sequences/aaa/aaa_00010/FX\r\n - /mnt/projects/climp/sequences/aaa/aaa_00010/Lay\r\n - /mnt/projects/climp/sequences/aaa/aaa_00010/Light\r\n\r\nProceeding would unregister the above paths from Toolkit's folder database.\r\nThis will not alter any of the content in the file system, but once you have\r\nunregistered the paths, they will not be recognized by Shotgun.\r\n\r\nThis is useful if you for example have renamed an Asset or Shot and want to\r\nmove the data around on disk. In this case, start by unregistering the\r\nexisting folder entries in Shotgun, then rename the Shot or Asset in Shotgun.\r\nNext, create new folders on disk using Toolkit's 'create folders' command and\r\nlastly move all your file system data across from the old location to the new\r\nlocation.\r\n\r\nProceed with unregister? (Yes/No) ? [Yes]: \r\n```\r\n\r\nAll of the commands are also available via the API:\r\n\r\n```\r\nMannes-MacBook-Pro-2:climp manne$ ./tank shell\r\n\r\nWelcome to the Shotgun Pipeline Toolkit!\r\nFor documentation, see https://toolkit.shotgunsoftware.com\r\nStarting Toolkit for your current path '/mnt/software/shotgun/climp'\r\n- The path is not associated with any Shotgun object.\r\n- Falling back on default project settings.\r\n- Using configuration 'Primary' and Core HEAD\r\n- Setting the Context to Climp.\r\n- Started Shell Engine version v0.4.0\r\n- Environment: /mnt/software/shotgun/climp/config/env/project.yml.\r\n- Running command shell...\r\n\r\n\r\n----------------------------------------------------------------------\r\nCommand: Shell\r\n----------------------------------------------------------------------\r\n\r\nWelcome to Shotgun Pipeline Toolkit Python!\r\n2.7.6 (default, Apr  2 2014, 14:45:52) \r\n[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)]\r\nRunning on darwin\r\n\r\n- A tk API handle is available via the tk variable\r\n- A Shotgun API handle is available via the shotgun variable\r\n- Your current context is stored in the context variable\r\n- The shell engine can be accessed via the engine variable\r\n\r\n>>> tk.list_commands()\r\n['setup_project', 'setup_project_factory', 'core', 'localize', 'share_core', 'attach_to_core', 'validate', 'cache_apps', 'clear_shotgun_menu_cache', 'app_info', 'install_app', 'install_engine', 'updates', 'configurations', 'synchronize_folders', 'unregister_folders', 'clone_configuration', 'copy_apps']\r\n\r\n>>> cmd = tk.get_command(\"unregister_folders\")\r\n\r\n>>> cmd.description\r\n'Unregisters the folders for an object in Shotgun.'\r\n\r\n>>> cmd.parameters\r\n{'entity': {'default': None,\r\n            'description': 'Entity to unregister. Should be a Shotgun style entity dictionary with keys type and id.',\r\n            'type': 'dict'},\r\n 'path': {'default': None,\r\n          'description': 'Path to unregister. Any child paths will be unregistered too.',\r\n          'type': 'str'}}\r\n\r\n>>> cmd.execute({\"path\": \"/mnt/projects/climp/sequences/ccc226/aaa_00010/Comp\"})\r\nINFO \r\nINFO The following folders will be unregistered:\r\nINFO  - /mnt/projects/climp/sequences/ccc226/aaa_00010/Comp\r\nINFO \r\nINFO Proceeding would unregister the above paths from Toolkit's folder database. This will not alter any of the content in the file system, but once you have unregistered the paths, they will not be recognized by Shotgun.\r\nINFO \r\nINFO This is useful if you for example have renamed an Asset or Shot and want to move the data around on disk. In this case, start by unregistering the existing folder entries in Shotgun, then rename the Shot or Asset in Shotgun. Next, create new folders on disk using Toolkit's 'create folders' command and lastly move all your file system data across from the old location to the new location.\r\nINFO \r\nINFO Removing items from Shotgun....\r\nINFO \r\n[Hang on, Toolkit is preparing folders...] Toolkit is retrieving folder\r\nlistings from Shotgun and ensuring that your setup is up to date. Hang tight\r\nwhile data is being downloaded...\r\nINFO \r\nINFO Unregister complete!\r\n[{'path': u'/mnt/projects/climp/sequences/ccc226/aaa_00010/Comp', 'sg_id': 3287}]\r\n\r\n\r\n>>> cmd.execute({\"entity\": {\"type\": \"Shot\", \"id\": 1670}})\r\nINFO \r\nINFO The following folders will be unregistered:\r\nINFO  - /mnt/projects/climp/sequences/ccc226/aaa_00020\r\nINFO  - /mnt/projects/climp/sequences/ccc226/aaa_00020/Anm\r\nINFO  - /mnt/projects/climp/sequences/ccc226/aaa_00020/Comp\r\nINFO  - /mnt/projects/climp/sequences/ccc226/aaa_00020/FX\r\nINFO  - /mnt/projects/climp/sequences/ccc226/aaa_00020/Lay\r\nINFO  - /mnt/projects/climp/sequences/ccc226/aaa_00020/Light\r\nINFO \r\nINFO Proceeding would unregister the above paths from Toolkit's folder database. This will not alter any of the content in the file system, but once you have unregistered the paths, they will not be recognized by Shotgun.\r\nINFO \r\nINFO This is useful if you for example have renamed an Asset or Shot and want to move the data around on disk. In this case, start by unregistering the existing folder entries in Shotgun, then rename the Shot or Asset in Shotgun. Next, create new folders on disk using Toolkit's 'create folders' command and lastly move all your file system data across from the old location to the new location.\r\nINFO \r\nINFO Removing items from Shotgun....\r\nINFO \r\n[Hang on, Toolkit is preparing folders...] Toolkit is retrieving folder\r\nlistings from Shotgun and ensuring that your setup is up to date. Hang tight\r\nwhile data is being downloaded...\r\nINFO \r\nINFO Unregister complete!\r\n[{'path': u'/mnt/projects/climp/sequences/ccc226/aaa_00020', 'sg_id': 3289}, {'path': u'/mnt/projects/climp/sequences/ccc226/aaa_00020/Anm', 'sg_id': 3290}, {'path': u'/mnt/projects/climp/sequences/ccc226/aaa_00020/Comp', 'sg_id': 3293}, {'path': u'/mnt/projects/climp/sequences/ccc226/aaa_00020/FX', 'sg_id': 3291}, {'path': u'/mnt/projects/climp/sequences/ccc226/aaa_00020/Lay', 'sg_id': 3294}, {'path': u'/mnt/projects/climp/sequences/ccc226/aaa_00020/Light', 'sg_id': 3292}]\r\n>>> \r\n```\r\n\r\nIf an entity has been deleted in Shotgun, paths can still be unregistered. In this case, just use the path form rather than the entity based form.\r\n\r\n\r\n","created_at":"2015-03-10T22:08:19Z","updated_at":"2015-03-17T04:32:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"08a212126cc85e17adb6c732aa8069ea69116cf1","assignee":{"login":"kporangehat","id":3391,"avatar_url":"https://avatars.githubusercontent.com/u/3391?v=3","gravatar_id":"","url":"https://api.github.com/users/kporangehat","html_url":"https://github.com/kporangehat","followers_url":"https://api.github.com/users/kporangehat/followers","following_url":"https://api.github.com/users/kporangehat/following{/other_user}","gists_url":"https://api.github.com/users/kporangehat/gists{/gist_id}","starred_url":"https://api.github.com/users/kporangehat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kporangehat/subscriptions","organizations_url":"https://api.github.com/users/kporangehat/orgs","repos_url":"https://api.github.com/users/kporangehat/repos","events_url":"https://api.github.com/users/kporangehat/events{/privacy}","received_events_url":"https://api.github.com/users/kporangehat/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/shotgunsoftware/tk-core/pulls/139/commits","review_comments_url":"https://api.github.com/repos/shotgunsoftware/tk-core/pulls/139/comments","review_comment_url":"https://api.github.com/repos/shotgunsoftware/tk-core/pulls/comments{/number}","comments_url":"https://api.github.com/repos/shotgunsoftware/tk-core/issues/139/comments","statuses_url":"https://api.github.com/repos/shotgunsoftware/tk-core/statuses/4781b32e67a4526dbcf3fc801cb0bc5badcfc618","head":{"label":"shotgunsoftware:28350_unregister_folders","ref":"28350_unregister_folders","sha":"4781b32e67a4526dbcf3fc801cb0bc5badcfc618","user":{"login":"shotgunsoftware","id":317894,"avatar_url":"https://avatars.githubusercontent.com/u/317894?v=3","gravatar_id":"","url":"https://api.github.com/users/shotgunsoftware","html_url":"https://github.com/shotgunsoftware","followers_url":"https://api.github.com/users/shotgunsoftware/followers","following_url":"https://api.github.com/users/shotgunsoftware/following{/other_user}","gists_url":"https://api.github.com/users/shotgunsoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/shotgunsoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shotgunsoftware/subscriptions","organizations_url":"https://api.github.com/users/shotgunsoftware/orgs","repos_url":"https://api.github.com/users/shotgunsoftware/repos","events_url":"https://api.github.com/users/shotgunsoftware/events{/privacy}","received_events_url":"https://api.github.com/users/shotgunsoftware/received_events","type":"Organization","site_admin":false},"repo":{"id":4270061,"name":"tk-core","full_name":"shotgunsoftware/tk-core","owner":{"login":"shotgunsoftware","id":317894,"avatar_url":"https://avatars.githubusercontent.com/u/317894?v=3","gravatar_id":"","url":"https://api.github.com/users/shotgunsoftware","html_url":"https://github.com/shotgunsoftware","followers_url":"https://api.github.com/users/shotgunsoftware/followers","following_url":"https://api.github.com/users/shotgunsoftware/following{/other_user}","gists_url":"https://api.github.com/users/shotgunsoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/shotgunsoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shotgunsoftware/subscriptions","organizations_url":"https://api.github.com/users/shotgunsoftware/orgs","repos_url":"https://api.github.com/users/shotgunsoftware/repos","events_url":"https://api.github.com/users/shotgunsoftware/events{/privacy}","received_events_url":"https://api.github.com/users/shotgunsoftware/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/shotgunsoftware/tk-core","description":"The Shotgun Pipeline Toolkit Core API","fork":false,"url":"https://api.github.com/repos/shotgunsoftware/tk-core","forks_url":"https://api.github.com/repos/shotgunsoftware/tk-core/forks","keys_url":"https://api.github.com/repos/shotgunsoftware/tk-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/shotgunsoftware/tk-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/shotgunsoftware/tk-core/teams","hooks_url":"https://api.github.com/repos/shotgunsoftware/tk-core/hooks","issue_events_url":"https://api.github.com/repos/shotgunsoftware/tk-core/issues/events{/number}","events_url":"https://api.github.com/repos/shotgunsoftware/tk-core/events","assignees_url":"https://api.github.com/repos/shotgunsoftware/tk-core/assignees{/user}","branches_url":"https://api.github.com/repos/shotgunsoftware/tk-core/branches{/branch}","tags_url":"https://api.github.com/repos/shotgunsoftware/tk-core/tags","blobs_url":"https://api.github.com/repos/shotgunsoftware/tk-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/shotgunsoftware/tk-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/shotgunsoftware/tk-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/shotgunsoftware/tk-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/shotgunsoftware/tk-core/statuses/{sha}","languages_url":"https://api.github.com/repos/shotgunsoftware/tk-core/languages","stargazers_url":"https://api.github.com/repos/shotgunsoftware/tk-core/stargazers","contributors_url":"https://api.github.com/repos/shotgunsoftware/tk-core/contributors","subscribers_url":"https://api.github.com/repos/shotgunsoftware/tk-core/subscribers","subscription_url":"https://api.github.com/repos/shotgunsoftware/tk-core/subscription","commits_url":"https://api.github.com/repos/shotgunsoftware/tk-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/shotgunsoftware/tk-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/shotgunsoftware/tk-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/shotgunsoftware/tk-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/shotgunsoftware/tk-core/contents/{+path}","compare_url":"https://api.github.com/repos/shotgunsoftware/tk-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/shotgunsoftware/tk-core/merges","archive_url":"https://api.github.com/repos/shotgunsoftware/tk-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/shotgunsoftware/tk-core/downloads","issues_url":"https://api.github.com/repos/shotgunsoftware/tk-core/issues{/number}","pulls_url":"https://api.github.com/repos/shotgunsoftware/tk-core/pulls{/number}","milestones_url":"https://api.github.com/repos/shotgunsoftware/tk-core/milestones{/number}","notifications_url":"https://api.github.com/repos/shotgunsoftware/tk-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/shotgunsoftware/tk-core/labels{/name}","releases_url":"https://api.github.com/repos/shotgunsoftware/tk-core/releases{/id}","created_at":"2012-05-09T09:12:06Z","updated_at":"2015-03-12T15:20:25Z","pushed_at":"2015-03-16T19:17:23Z","git_url":"git://github.com/shotgunsoftware/tk-core.git","ssh_url":"git@github.com:shotgunsoftware/tk-core.git","clone_url":"https://github.com/shotgunsoftware/tk-core.git","svn_url":"https://github.com/shotgunsoftware/tk-core","homepage":"","size":40868,"stargazers_count":15,"watchers_count":15,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"open_issues_count":10,"forks":9,"open_issues":10,"watchers":15,"default_branch":"master"}},"base":{"label":"shotgunsoftware:master","ref":"master","sha":"b7ab9cf882deeb393f0406853b4dd3ffcfd01ce1","user":{"login":"shotgunsoftware","id":317894,"avatar_url":"https://avatars.githubusercontent.com/u/317894?v=3","gravatar_id":"","url":"https://api.github.com/users/shotgunsoftware","html_url":"https://github.com/shotgunsoftware","followers_url":"https://api.github.com/users/shotgunsoftware/followers","following_url":"https://api.github.com/users/shotgunsoftware/following{/other_user}","gists_url":"https://api.github.com/users/shotgunsoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/shotgunsoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shotgunsoftware/subscriptions","organizations_url":"https://api.github.com/users/shotgunsoftware/orgs","repos_url":"https://api.github.com/users/shotgunsoftware/repos","events_url":"https://api.github.com/users/shotgunsoftware/events{/privacy}","received_events_url":"https://api.github.com/users/shotgunsoftware/received_events","type":"Organization","site_admin":false},"repo":{"id":4270061,"name":"tk-core","full_name":"shotgunsoftware/tk-core","owner":{"login":"shotgunsoftware","id":317894,"avatar_url":"https://avatars.githubusercontent.com/u/317894?v=3","gravatar_id":"","url":"https://api.github.com/users/shotgunsoftware","html_url":"https://github.com/shotgunsoftware","followers_url":"https://api.github.com/users/shotgunsoftware/followers","following_url":"https://api.github.com/users/shotgunsoftware/following{/other_user}","gists_url":"https://api.github.com/users/shotgunsoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/shotgunsoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shotgunsoftware/subscriptions","organizations_url":"https://api.github.com/users/shotgunsoftware/orgs","repos_url":"https://api.github.com/users/shotgunsoftware/repos","events_url":"https://api.github.com/users/shotgunsoftware/events{/privacy}","received_events_url":"https://api.github.com/users/shotgunsoftware/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/shotgunsoftware/tk-core","description":"The Shotgun Pipeline Toolkit Core API","fork":false,"url":"https://api.github.com/repos/shotgunsoftware/tk-core","forks_url":"https://api.github.com/repos/shotgunsoftware/tk-core/forks","keys_url":"https://api.github.com/repos/shotgunsoftware/tk-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/shotgunsoftware/tk-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/shotgunsoftware/tk-core/teams","hooks_url":"https://api.github.com/repos/shotgunsoftware/tk-core/hooks","issue_events_url":"https://api.github.com/repos/shotgunsoftware/tk-core/issues/events{/number}","events_url":"https://api.github.com/repos/shotgunsoftware/tk-core/events","assignees_url":"https://api.github.com/repos/shotgunsoftware/tk-core/assignees{/user}","branches_url":"https://api.github.com/repos/shotgunsoftware/tk-core/branches{/branch}","tags_url":"https://api.github.com/repos/shotgunsoftware/tk-core/tags","blobs_url":"https://api.github.com/repos/shotgunsoftware/tk-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/shotgunsoftware/tk-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/shotgunsoftware/tk-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/shotgunsoftware/tk-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/shotgunsoftware/tk-core/statuses/{sha}","languages_url":"https://api.github.com/repos/shotgunsoftware/tk-core/languages","stargazers_url":"https://api.github.com/repos/shotgunsoftware/tk-core/stargazers","contributors_url":"https://api.github.com/repos/shotgunsoftware/tk-core/contributors","subscribers_url":"https://api.github.com/repos/shotgunsoftware/tk-core/subscribers","subscription_url":"https://api.github.com/repos/shotgunsoftware/tk-core/subscription","commits_url":"https://api.github.com/repos/shotgunsoftware/tk-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/shotgunsoftware/tk-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/shotgunsoftware/tk-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/shotgunsoftware/tk-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/shotgunsoftware/tk-core/contents/{+path}","compare_url":"https://api.github.com/repos/shotgunsoftware/tk-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/shotgunsoftware/tk-core/merges","archive_url":"https://api.github.com/repos/shotgunsoftware/tk-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/shotgunsoftware/tk-core/downloads","issues_url":"https://api.github.com/repos/shotgunsoftware/tk-core/issues{/number}","pulls_url":"https://api.github.com/repos/shotgunsoftware/tk-core/pulls{/number}","milestones_url":"https://api.github.com/repos/shotgunsoftware/tk-core/milestones{/number}","notifications_url":"https://api.github.com/repos/shotgunsoftware/tk-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/shotgunsoftware/tk-core/labels{/name}","releases_url":"https://api.github.com/repos/shotgunsoftware/tk-core/releases{/id}","created_at":"2012-05-09T09:12:06Z","updated_at":"2015-03-12T15:20:25Z","pushed_at":"2015-03-16T19:17:23Z","git_url":"git://github.com/shotgunsoftware/tk-core.git","ssh_url":"git@github.com:shotgunsoftware/tk-core.git","clone_url":"https://github.com/shotgunsoftware/tk-core.git","svn_url":"https://github.com/shotgunsoftware/tk-core","homepage":"","size":40868,"stargazers_count":15,"watchers_count":15,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"open_issues_count":10,"forks":9,"open_issues":10,"watchers":15,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/shotgunsoftware/tk-core/pulls/139"},"html":{"href":"https://github.com/shotgunsoftware/tk-core/pull/139"},"issue":{"href":"https://api.github.com/repos/shotgunsoftware/tk-core/issues/139"},"comments":{"href":"https://api.github.com/repos/shotgunsoftware/tk-core/issues/139/comments"},"review_comments":{"href":"https://api.github.com/repos/shotgunsoftware/tk-core/pulls/139/comments"},"review_comment":{"href":"https://api.github.com/repos/shotgunsoftware/tk-core/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/shotgunsoftware/tk-core/pulls/139/commits"},"statuses":{"href":"https://api.github.com/repos/shotgunsoftware/tk-core/statuses/4781b32e67a4526dbcf3fc801cb0bc5badcfc618"}}}}