{"thread":{"id":"57106","subject":"[PATCH 0/2] git-p4: remove \"debug\" and \"rollback\" verbs","startedAt":"2021-12-17T13:48:47Z","lastAt":"2021-12-17T13:48:55Z","messageCount":3,"participants":["Joel Holdsworth"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"444358","messageId":"20211217134814.2112631-1-jholdsworth@nvidia.com","threadId":"57106","inReplyTo":null,"subject":"[PATCH 0/2] git-p4: remove \"debug\" and \"rollback\" verbs","fromName":"Joel Holdsworth","fromEmail":"jholdsworth@nvidia.com","sentAt":"2021-12-17T13:48:12Z","receivedAt":"2021-12-17T13:48:47Z","isPatch":true,"sender":{"key":"jholdsworth@nvidia.com","avatar":"https://avatars.githubusercontent.com/u/1449493?v=4"},"body":"git-p4 contains a selection of verbs for various functions of the\nscript. The \"debug\" and \"rollback\" verbs appear to have been added early\nin the development life of git-p4. They were once used as debugging\ntools, but no longer serve any useful purpose either for developers or\nusers. Removing these verbs simplifies the script by removing dead code,\nand increases usability by reducing complaexity.\n\nJoel Holdsworth (2):\n  git-p4: remove \"delete\" verb\n  git-p4: remove \"rollback\" verb\n\n git-p4.py | 76 -------------------------------------------------------\n 1 file changed, 76 deletions(-)\n\n-- \n2.34.1\n\n"},{"id":"444359","messageId":"20211217134814.2112631-2-jholdsworth@nvidia.com","threadId":"57106","inReplyTo":"20211217134814.2112631-1-jholdsworth@nvidia.com","subject":"[PATCH 1/2] git-p4: remove \"delete\" verb","fromName":"Joel Holdsworth","fromEmail":"jholdsworth@nvidia.com","sentAt":"2021-12-17T13:48:13Z","receivedAt":"2021-12-17T13:48:52Z","isPatch":true,"sender":{"key":"jholdsworth@nvidia.com","avatar":"https://avatars.githubusercontent.com/u/1449493?v=4"},"body":"The git-p4 \"delete\" verb is described as \"A tool to debug the output of\np4 -G\". However, the implementation provided is of no useful benefit to\neither users or developers.\n---\n git-p4.py | 16 ----------------\n 1 file changed, 16 deletions(-)\n\ndiff --git a/git-p4.py b/git-p4.py\nindex 2b4500226a..b7ed8e41ff 100755\n--- a/git-p4.py\n+++ b/git-p4.py\n@@ -1532,21 +1532,6 @@ def loadUserMapFromCache(self):\n         except IOError:\n             self.getUserMapFromPerforceServer()\n \n-class P4Debug(Command):\n-    def __init__(self):\n-        Command.__init__(self)\n-        self.options = []\n-        self.description = \"A tool to debug the output of p4 -G.\"\n-        self.needsGit = False\n-\n-    def run(self, args):\n-        j = 0\n-        for output in p4CmdList(args):\n-            print('Element: %d' % j)\n-            j += 1\n-            print(output)\n-        return True\n-\n class P4RollBack(Command):\n     def __init__(self):\n         Command.__init__(self)\n@@ -4363,7 +4348,6 @@ def printUsage(commands):\n     print(\"\")\n \n commands = {\n-    \"debug\" : P4Debug,\n     \"submit\" : P4Submit,\n     \"commit\" : P4Submit,\n     \"sync\" : P4Sync,\n-- \n2.34.1\n\n"},{"id":"444360","messageId":"20211217134814.2112631-3-jholdsworth@nvidia.com","threadId":"57106","inReplyTo":"20211217134814.2112631-1-jholdsworth@nvidia.com","subject":"[PATCH 2/2] git-p4: remove \"rollback\" verb","fromName":"Joel Holdsworth","fromEmail":"jholdsworth@nvidia.com","sentAt":"2021-12-17T13:48:14Z","receivedAt":"2021-12-17T13:48:55Z","isPatch":true,"sender":{"key":"jholdsworth@nvidia.com","avatar":"https://avatars.githubusercontent.com/u/1449493?v=4"},"body":"The git-p4 \"rollback\" verb is described as \"A tool to debug the\nmulti-branch import. Don't use :)\". The implementation provided is of no\nuseful benefit to either users or developers.\n---\n git-p4.py | 60 -------------------------------------------------------\n 1 file changed, 60 deletions(-)\n\ndiff --git a/git-p4.py b/git-p4.py\nindex b7ed8e41ff..a7cb321f75 100755\n--- a/git-p4.py\n+++ b/git-p4.py\n@@ -1532,65 +1532,6 @@ def loadUserMapFromCache(self):\n         except IOError:\n             self.getUserMapFromPerforceServer()\n \n-class P4RollBack(Command):\n-    def __init__(self):\n-        Command.__init__(self)\n-        self.options = [\n-            optparse.make_option(\"--local\", dest=\"rollbackLocalBranches\", action=\"store_true\")\n-        ]\n-        self.description = \"A tool to debug the multi-branch import. Don't use :)\"\n-        self.rollbackLocalBranches = False\n-\n-    def run(self, args):\n-        if len(args) != 1:\n-            return False\n-        maxChange = int(args[0])\n-\n-        if \"p4ExitCode\" in p4Cmd(\"changes -m 1\"):\n-            die(\"Problems executing p4\");\n-\n-        if self.rollbackLocalBranches:\n-            refPrefix = \"refs/heads/\"\n-            lines = read_pipe_lines(\"git rev-parse --symbolic --branches\")\n-        else:\n-            refPrefix = \"refs/remotes/\"\n-            lines = read_pipe_lines(\"git rev-parse --symbolic --remotes\")\n-\n-        for line in lines:\n-            if self.rollbackLocalBranches or (line.startswith(\"p4/\") and line != \"p4/HEAD\\n\"):\n-                line = line.strip()\n-                ref = refPrefix + line\n-                log = extractLogMessageFromGitCommit(ref)\n-                settings = extractSettingsGitLog(log)\n-\n-                depotPaths = settings['depot-paths']\n-                change = settings['change']\n-\n-                changed = False\n-\n-                if len(p4Cmd(\"changes -m 1 \"  + ' '.join (['%s...@%s' % (p, maxChange)\n-                                                           for p in depotPaths]))) == 0:\n-                    print(\"Branch %s did not exist at change %s, deleting.\" % (ref, maxChange))\n-                    system(\"git update-ref -d %s `git rev-parse %s`\" % (ref, ref))\n-                    continue\n-\n-                while change and int(change) > maxChange:\n-                    changed = True\n-                    if self.verbose:\n-                        print(\"%s is at %s ; rewinding towards %s\" % (ref, change, maxChange))\n-                    system(\"git update-ref %s \\\"%s^\\\"\" % (ref, ref))\n-                    log = extractLogMessageFromGitCommit(ref)\n-                    settings =  extractSettingsGitLog(log)\n-\n-\n-                    depotPaths = settings['depot-paths']\n-                    change = settings['change']\n-\n-                if changed:\n-                    print(\"%s rewound to %s\" % (ref, change))\n-\n-        return True\n-\n class P4Submit(Command, P4UserMap):\n \n     conflict_behavior_choices = (\"ask\", \"skip\", \"quit\")\n@@ -4353,7 +4294,6 @@ def printUsage(commands):\n     \"sync\" : P4Sync,\n     \"rebase\" : P4Rebase,\n     \"clone\" : P4Clone,\n-    \"rollback\" : P4RollBack,\n     \"branches\" : P4Branches,\n     \"unshelve\" : P4Unshelve,\n }\n-- \n2.34.1\n\n"}]}