{"thread":{"id":"31301","subject":"[PATCH] git-p4: Strip branch name prefixes if --use-client-spec enabled","startedAt":"2012-08-20T23:43:30Z","lastAt":"2012-08-22T21:22:41Z","messageCount":2,"participants":["Patrick C. McGinty","Pete Wyckoff"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"197475","messageId":"1345506210-17382-1-git-send-email-casey.mcginty@gmail.com","threadId":"31301","inReplyTo":null,"subject":"[PATCH] git-p4: Strip branch name prefixes if --use-client-spec enabled","fromName":"Patrick C. McGinty","fromEmail":"casey.mcginty@gmail.com","sentAt":"2012-08-20T23:43:30Z","receivedAt":"2012-08-20T23:43:30Z","isPatch":true,"sender":{"key":"casey.mcginty@gmail.com","avatar":null},"body":"From: \"Patrick C. McGinty\" <casey.mcginty@gmail.com>\n\nThis removes the branch names from being included in the file system\npath when using the both --use-client-spec and --detect-branches\noptions.\n\nUsed alone, the --detect-branches option did the right thing, removing\nthe branch names from the relative git path. By adding the\n--use-client-spec option, the old logic would incorrectly bypass this\nstep.\n\nSigned-off-by: Patrick C. McGinty <casey.mcginty@gmail.com>\n---\n git-p4.py |   10 +++++++++-\n 1 file changed, 9 insertions(+), 1 deletion(-)\n\ndiff --git a/git-p4.py b/git-p4.py\nindex e67d37d..9489845 100755\n--- a/git-p4.py\n+++ b/git-p4.py\n@@ -1819,7 +1819,15 @@ class P4Sync(Command, P4UserMap):\n \n     def stripRepoPath(self, path, prefixes):\n         if self.useClientSpec:\n-            return self.clientSpecDirs.map_in_client(path)\n+            # map path to user defined client location\n+            path = self.clientSpecDirs.map_in_client(path)\n+            # Remove prefixes (e.g. branch names) from path. Apply the\n+            # clientSpecDirs map to the prefix paths to match the\n+            # modified path value.\n+            for p in map(self.clientSpecDirs.map_in_client, prefixes):\n+               if p and p4PathStartsWith( path, p):\n+                  path = path[len(p):]\n+            return path\n \n         if self.keepRepoPath:\n             prefixes = [re.sub(\"^(//[^/]+/).*\", r'\\1', prefixes[0])]\n-- \n1.7.9.5\n"},{"id":"197664","messageId":"20120822212241.GA29233@padd.com","threadId":"31301","inReplyTo":"1345506210-17382-1-git-send-email-casey.mcginty@gmail.com","subject":"Re: [PATCH] git-p4: Strip branch name prefixes if --use-client-spec enabled","fromName":"Pete Wyckoff","fromEmail":"pw@padd.com","sentAt":"2012-08-22T21:22:41Z","receivedAt":"2012-08-22T21:22:41Z","isPatch":true,"sender":{"key":"pw@padd.com","avatar":null},"body":"casey.mcginty@gmail.com wrote on Mon, 20 Aug 2012 13:43 -1000:\n> This removes the branch names from being included in the file system\n> path when using the both --use-client-spec and --detect-branches\n> options.\n> \n> Used alone, the --detect-branches option did the right thing, removing\n> the branch names from the relative git path. By adding the\n> --use-client-spec option, the old logic would incorrectly bypass this\n> step.\n\nThanks for reporting this bug, and supplying a fix.  I think,\nthough that this is the same issue we were looking at in this\nthread:\n\n    http://article.gmane.org/gmane.comp.version-control.git/203294\n\nIt is queued up and the fix likely will appear in 1.7.13 (or\nwhatever the next release after 1.7.12 is called).\n\n(Gmane has been down all day from here; there's information from\nanother reporter in http://stackoverflow.com/questions/11893688/ .)\n\n\t\t-- Pete\n"}]}