{"thread":{"id":"25784","subject":"[PATCH 0/2] git-p4: Rename and copy detection improvements.","startedAt":"2010-11-19T01:38:11Z","lastAt":"2011-02-04T08:59:07Z","messageCount":15,"participants":["Vitor Antunes","Thomas Berg"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"156147","messageId":"1290130693-30855-1-git-send-email-vitor.hda@gmail.com","threadId":"25784","inReplyTo":null,"subject":"[PATCH 0/2] git-p4: Rename and copy detection improvements.","fromName":"Vitor Antunes","fromEmail":"vitor.hda@gmail.com","sentAt":"2010-11-19T01:38:11Z","receivedAt":"2010-11-19T01:38:11Z","isPatch":true,"sender":{"key":"vitor.hda@gmail.com","avatar":"https://avatars.githubusercontent.com/u/606876?v=4"},"body":"Two patches to improve the rename and copy detection implementation in git-p4.\nAlso added some configuration options for ease of use.\n\nVitor Antunes (2):\n  git-p4: Don't edit renamed files if not necessary.\n  git-p4: Added copy detection support\n\n contrib/fast-import/git-p4 |   28 ++++++++++++++++++++++++++--\n 1 files changed, 26 insertions(+), 2 deletions(-)\n\n-- \n1.7.2.3\n"},{"id":"156148","messageId":"1290130693-30855-2-git-send-email-vitor.hda@gmail.com","threadId":"25784","inReplyTo":"1290130693-30855-1-git-send-email-vitor.hda@gmail.com","subject":"[PATCH 1/2] git-p4: Don't edit renamed files if not necessary.","fromName":"Vitor Antunes","fromEmail":"vitor.hda@gmail.com","sentAt":"2010-11-19T01:38:12Z","receivedAt":"2010-11-19T01:38:12Z","isPatch":true,"sender":{"key":"vitor.hda@gmail.com","avatar":"https://avatars.githubusercontent.com/u/606876?v=4"},"body":"Only open files for edit after integrating if the SHA1 of source and\ndestination differ from each other.\nAlso added git config option to allow permanent rename detection.\nThe detectRenames option should be set to the desired threshold value.\nRename detection can still be enabled through -M option.\n---\n contrib/fast-import/git-p4 |   11 +++++++++--\n 1 files changed, 9 insertions(+), 2 deletions(-)\n\ndiff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4\nindex 04ce7e3..ba18512 100755\n--- a/contrib/fast-import/git-p4\n+++ b/contrib/fast-import/git-p4\n@@ -613,7 +613,13 @@ class P4Submit(Command):\n \n     def applyCommit(self, id):\n         print \"Applying %s\" % (read_pipe(\"git log --max-count=1 --pretty=oneline %s\" % id))\n-        diffOpts = (\"\", \"-M\")[self.detectRename]\n+\n+        detectRenames = gitConfig(\"git-p4.detectRenames\")\n+        if len(detectRenames) > 0:\n+            diffOpts = \"-M%s\" % detectRenames\n+        else:\n+            diffOpts = (\"\", \"-M\")[self.detectRenames]\n+\n         diff = read_pipe_lines(\"git diff-tree -r %s \\\"%s^\\\" \\\"%s\\\"\" % (diffOpts, id, id))\n         filesToAdd = set()\n         filesToDelete = set()\n@@ -640,7 +646,8 @@ class P4Submit(Command):\n             elif modifier == \"R\":\n                 src, dest = diff['src'], diff['dst']\n                 p4_system(\"integrate -Dt \\\"%s\\\" \\\"%s\\\"\" % (src, dest))\n-                p4_system(\"edit \\\"%s\\\"\" % (dest))\n+                if diff['src_sha1'] != diff['dst_sha1']:\n+                    p4_system(\"edit \\\"%s\\\"\" % (dest))\n                 if isModeExecChanged(diff['src_mode'], diff['dst_mode']):\n                     filesToChangeExecBit[dest] = diff['dst_mode']\n                 os.unlink(dest)\n-- \n1.7.2.3\n"},{"id":"156149","messageId":"1290130693-30855-3-git-send-email-vitor.hda@gmail.com","threadId":"25784","inReplyTo":"1290130693-30855-1-git-send-email-vitor.hda@gmail.com","subject":"[PATCH 2/2] git-p4: Added copy detection support","fromName":"Vitor Antunes","fromEmail":"vitor.hda@gmail.com","sentAt":"2010-11-19T01:38:13Z","receivedAt":"2010-11-19T01:38:13Z","isPatch":true,"sender":{"key":"vitor.hda@gmail.com","avatar":"https://avatars.githubusercontent.com/u/606876?v=4"},"body":"Added new config options:\n    git-p4.detectCopies         - Enable copy detection.\n    git-p4.detectCopiesHarder   - Find copies harder.\nThe detectCopies option should be set to the desired threshold value.\nThe detectCopiesHarder option receives a simple true/false value.\nP4Submit is now able to process diff-tree C status.\n---\n contrib/fast-import/git-p4 |   17 +++++++++++++++++\n 1 files changed, 17 insertions(+), 0 deletions(-)\n\ndiff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4\nindex ba18512..0ea3a44 100755\n--- a/contrib/fast-import/git-p4\n+++ b/contrib/fast-import/git-p4\n@@ -620,6 +620,14 @@ class P4Submit(Command):\n         else:\n             diffOpts = (\"\", \"-M\")[self.detectRenames]\n \n+        detectCopies = gitConfig(\"git-p4.detectCopies\")\n+        if len(detectCopies) > 0:\n+            diffOpts += \" -C%s\" % detectCopies\n+\n+        detectCopiesHarder = gitConfig(\"git-p4.detectCopiesHarder\")\n+        if len(detectCopiesHarder) > 0 and detectCopiesHarder.lower() != \"false\":\n+            diffOpts += \" --find-copies-harder\"\n+\n         diff = read_pipe_lines(\"git diff-tree -r %s \\\"%s^\\\" \\\"%s\\\"\" % (diffOpts, id, id))\n         filesToAdd = set()\n         filesToDelete = set()\n@@ -643,6 +651,15 @@ class P4Submit(Command):\n                 filesToDelete.add(path)\n                 if path in filesToAdd:\n                     filesToAdd.remove(path)\n+            elif modifier == \"C\":\n+                src, dest = diff['src'], diff['dst']\n+                p4_system(\"integrate -Dt \\\"%s\\\" \\\"%s\\\"\" % (src, dest))\n+                if diff['src_sha1'] != diff['dst_sha1']:\n+                    p4_system(\"edit \\\"%s\\\"\" % (dest))\n+                if isModeExecChanged(diff['src_mode'], diff['dst_mode']):\n+                    filesToChangeExecBit[dest] = diff['dst_mode']\n+                os.unlink(dest)\n+                editedFiles.add(dest)\n             elif modifier == \"R\":\n                 src, dest = diff['src'], diff['dst']\n                 p4_system(\"integrate -Dt \\\"%s\\\" \\\"%s\\\"\" % (src, dest))\n-- \n1.7.2.3\n"},{"id":"156169","messageId":"AANLkTimkHECHmn22xY3fHzJd0KQD7EMJhHj0hCA+ccBs@mail.gmail.com","threadId":"25784","inReplyTo":"1290130693-30855-2-git-send-email-vitor.hda@gmail.com","subject":"Re: [PATCH 1/2] git-p4: Don't edit renamed files if not necessary.","fromName":"Vitor Antunes","fromEmail":"vitor.hda@gmail.com","sentAt":"2010-11-19T12:14:14Z","receivedAt":"2010-11-19T12:14:14Z","isPatch":true,"sender":{"key":"vitor.hda@gmail.com","avatar":"https://avatars.githubusercontent.com/u/606876?v=4"},"body":"There is a typo in this patch. I'll send a patch this night.\n\nSorry.\n\nOn Fri, Nov 19, 2010 at 1:38 AM, Vitor Antunes <vitor.hda@gmail.com> wrote:\n> Only open files for edit after integrating if the SHA1 of source and\n> destination differ from each other.\n> Also added git config option to allow permanent rename detection.\n> The detectRenames option should be set to the desired threshold value.\n> Rename detection can still be enabled through -M option.\n> ---\n>  contrib/fast-import/git-p4 |   11 +++++++++--\n>  1 files changed, 9 insertions(+), 2 deletions(-)\n>\n> diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4\n> index 04ce7e3..ba18512 100755\n> --- a/contrib/fast-import/git-p4\n> +++ b/contrib/fast-import/git-p4\n> @@ -613,7 +613,13 @@ class P4Submit(Command):\n>\n>     def applyCommit(self, id):\n>         print \"Applying %s\" % (read_pipe(\"git log --max-count=1 --pretty=oneline %s\" % id))\n> -        diffOpts = (\"\", \"-M\")[self.detectRename]\n> +\n> +        detectRenames = gitConfig(\"git-p4.detectRenames\")\n> +        if len(detectRenames) > 0:\n> +            diffOpts = \"-M%s\" % detectRenames\n> +        else:\n> +            diffOpts = (\"\", \"-M\")[self.detectRenames]\n> +\n>         diff = read_pipe_lines(\"git diff-tree -r %s \\\"%s^\\\" \\\"%s\\\"\" % (diffOpts, id, id))\n>         filesToAdd = set()\n>         filesToDelete = set()\n> @@ -640,7 +646,8 @@ class P4Submit(Command):\n>             elif modifier == \"R\":\n>                 src, dest = diff['src'], diff['dst']\n>                 p4_system(\"integrate -Dt \\\"%s\\\" \\\"%s\\\"\" % (src, dest))\n> -                p4_system(\"edit \\\"%s\\\"\" % (dest))\n> +                if diff['src_sha1'] != diff['dst_sha1']:\n> +                    p4_system(\"edit \\\"%s\\\"\" % (dest))\n>                 if isModeExecChanged(diff['src_mode'], diff['dst_mode']):\n>                     filesToChangeExecBit[dest] = diff['dst_mode']\n>                 os.unlink(dest)\n> --\n> 1.7.2.3\n>\n>\n\n\n\n-- \nVitor Antunes\n"},{"id":"156514","messageId":"1290648419-6107-1-git-send-email-vitor.hda@gmail.com","threadId":"25784","inReplyTo":"1290130693-30855-2-git-send-email-vitor.hda@gmail.com","subject":"[PATCH] git-p4: Corrected typo.","fromName":"Vitor Antunes","fromEmail":"vitor.hda@gmail.com","sentAt":"2010-11-25T01:26:59Z","receivedAt":"2010-11-25T01:26:59Z","isPatch":true,"sender":{"key":"vitor.hda@gmail.com","avatar":"https://avatars.githubusercontent.com/u/606876?v=4"},"body":"---\n contrib/fast-import/git-p4 |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4\nindex 0ea3a44..a466847 100755\n--- a/contrib/fast-import/git-p4\n+++ b/contrib/fast-import/git-p4\n@@ -618,7 +618,7 @@ class P4Submit(Command):\n         if len(detectRenames) > 0:\n             diffOpts = \"-M%s\" % detectRenames\n         else:\n-            diffOpts = (\"\", \"-M\")[self.detectRenames]\n+            diffOpts = (\"\", \"-M\")[self.detectRename]\n \n         detectCopies = gitConfig(\"git-p4.detectCopies\")\n         if len(detectCopies) > 0:\n-- \n1.7.2.3\n"},{"id":"159965","messageId":"AANLkTimQhFzEXr=T9F8TJzTeWwKroTt_BG87RtQCLivv@mail.gmail.com","threadId":"25784","inReplyTo":"1290648419-6107-1-git-send-email-vitor.hda@gmail.com","subject":"Re: [PATCH] git-p4: Corrected typo.","fromName":"Vitor Antunes","fromEmail":"vitor.hda@gmail.com","sentAt":"2011-01-27T23:35:14Z","receivedAt":"2011-01-27T23:35:14Z","isPatch":true,"sender":{"key":"vitor.hda@gmail.com","avatar":"https://avatars.githubusercontent.com/u/606876?v=4"},"body":"Hi everyone,\n\nCould anyone comment the 3 patches I sent (being this the last one)?\n\nThanks in advance,\nVitor\n\nOn Thu, Nov 25, 2010 at 1:26 AM, Vitor Antunes <vitor.hda@gmail.com> wrote:\n> ---\n>  contrib/fast-import/git-p4 |    2 +-\n>  1 files changed, 1 insertions(+), 1 deletions(-)\n>\n> diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4\n> index 0ea3a44..a466847 100755\n> --- a/contrib/fast-import/git-p4\n> +++ b/contrib/fast-import/git-p4\n> @@ -618,7 +618,7 @@ class P4Submit(Command):\n>         if len(detectRenames) > 0:\n>             diffOpts = \"-M%s\" % detectRenames\n>         else:\n> -            diffOpts = (\"\", \"-M\")[self.detectRenames]\n> +            diffOpts = (\"\", \"-M\")[self.detectRename]\n>\n>         detectCopies = gitConfig(\"git-p4.detectCopies\")\n>         if len(detectCopies) > 0:\n> --\n> 1.7.2.3\n>\n>\n\n\n\n-- \nVitor Antunes\n"},{"id":"159987","messageId":"AANLkTikeB724f_vE6qvu1h1o5JG150mcmaHVBjLkOEWP@mail.gmail.com","threadId":"25784","inReplyTo":"AANLkTimQhFzEXr=T9F8TJzTeWwKroTt_BG87RtQCLivv@mail.gmail.com","subject":"Re: [PATCH] git-p4: Corrected typo.","fromName":"Thomas Berg","fromEmail":"merlin66b@gmail.com","sentAt":"2011-01-28T15:19:33Z","receivedAt":"2011-01-28T15:19:33Z","isPatch":true,"sender":{"key":"merlin66b@gmail.com","avatar":null},"body":"Hi,\n\nOn Fri, Jan 28, 2011 at 12:35 AM, Vitor Antunes <vitor.hda@gmail.com> wrote:\n> Hi everyone,\n>\n> Could anyone comment the 3 patches I sent (being this the last one)?\n>\n[...]\n> On Thu, Nov 25, 2010 at 1:26 AM, Vitor Antunes <vitor.hda@gmail.com> wrote:\n>> ---\n>>  contrib/fast-import/git-p4 |    2 +-\n>>  1 files changed, 1 insertions(+), 1 deletions(-)\n>>\n>> diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4\n>> index 0ea3a44..a466847 100755\n>> --- a/contrib/fast-import/git-p4\n>> +++ b/contrib/fast-import/git-p4\n>> @@ -618,7 +618,7 @@ class P4Submit(Command):\n>>         if len(detectRenames) > 0:\n>>             diffOpts = \"-M%s\" % detectRenames\n>>         else:\n>> -            diffOpts = (\"\", \"-M\")[self.detectRenames]\n>> +            diffOpts = (\"\", \"-M\")[self.detectRename]\n>>\n\nThis appears to me to be a bugfix for one of the other patches you\nsent, is that right?\n\nIf so, maybe you could squash it with the previous patch and re-send\nit all to the list?\n\nMy other comments for now are:\n- you have forgotten to sign off on the patches\n- commit messages are normally in imperative rather than past tense\n(see Documentation/SubmittingPatches in git)\n\n- In your first patch you wrote:\n> The detectRenames option should be set to the desired threshold value.\nI'm not sure what threshold value you refer to here, and what values\nyou can set it to. Am I missing something?\n(I'm not very familiar with git rename detection options)\n\nI'm a git-p4 user, so I can test your changes and look a bit more at\nyour code. Someone verifying it could help getting the patches\napplied.\n\nThanks for improving git-p4!\n\nCheers,\nThomas Berg\n"},{"id":"160017","messageId":"AANLkTimLQxiB=dnd6=iB5uEpzOSfqks=FDJ=xORehuw8@mail.gmail.com","threadId":"25784","inReplyTo":"AANLkTikeB724f_vE6qvu1h1o5JG150mcmaHVBjLkOEWP@mail.gmail.com","subject":"Re: [PATCH] git-p4: Corrected typo.","fromName":"Vitor Antunes","fromEmail":"vitor.hda@gmail.com","sentAt":"2011-01-29T02:41:49Z","receivedAt":"2011-01-29T02:41:49Z","isPatch":true,"sender":{"key":"vitor.hda@gmail.com","avatar":"https://avatars.githubusercontent.com/u/606876?v=4"},"body":"Hi Thomas,\n\nFirst of all I'd like to thank you on your feedback. It's my first try\non creating submitting a patch, so having someone's guidance helps a\nlot :)\n\nI'll rebase my patches against the head of the tree and squash the fix\nto avoid multiple commits. While I do that I'll also review my commit\nmessage and sign-off the patches according to what you said. Hopefully\nI will be able to do this during this weekend.\n\nFrom git-diff-tree man page:\n\n\"\"\"\n-M[<n>]\n    Detect renames. If n is specified, it is a is a threshold on the\nsimilarity index (i.e. amount of addition/deletions compared to the\nfile’s\n    size). For example, -M90% means git should consider a delete/add\npair to be a rename if more than 90% of the file hasn’t changed.\n\"\"\"\n\nBut from my latest tests I think that this option is ignored in\ndiff-tree (I think it's only used in git log). With this in mind I'll\nneed to add some code to implement the check of the score value of\ndiff-tree output string. Again from its man page:\n\n\"\"\"\nStatus letters C and R are always followed by a score (denoting the\npercentage of similarity between the source and target of the move or\ncopy), and are the only ones to be so.\n\"\"\"\n\nThanks,\nVitor\n\nOn Fri, Jan 28, 2011 at 3:19 PM, Thomas Berg <merlin66b@gmail.com> wrote:\n> Hi,\n>\n> On Fri, Jan 28, 2011 at 12:35 AM, Vitor Antunes <vitor.hda@gmail.com> wrote:\n>> Hi everyone,\n>>\n>> Could anyone comment the 3 patches I sent (being this the last one)?\n>>\n> [...]\n>> On Thu, Nov 25, 2010 at 1:26 AM, Vitor Antunes <vitor.hda@gmail.com> wrote:\n>>> ---\n>>>  contrib/fast-import/git-p4 |    2 +-\n>>>  1 files changed, 1 insertions(+), 1 deletions(-)\n>>>\n>>> diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4\n>>> index 0ea3a44..a466847 100755\n>>> --- a/contrib/fast-import/git-p4\n>>> +++ b/contrib/fast-import/git-p4\n>>> @@ -618,7 +618,7 @@ class P4Submit(Command):\n>>>         if len(detectRenames) > 0:\n>>>             diffOpts = \"-M%s\" % detectRenames\n>>>         else:\n>>> -            diffOpts = (\"\", \"-M\")[self.detectRenames]\n>>> +            diffOpts = (\"\", \"-M\")[self.detectRename]\n>>>\n>\n> This appears to me to be a bugfix for one of the other patches you\n> sent, is that right?\n>\n> If so, maybe you could squash it with the previous patch and re-send\n> it all to the list?\n>\n> My other comments for now are:\n> - you have forgotten to sign off on the patches\n> - commit messages are normally in imperative rather than past tense\n> (see Documentation/SubmittingPatches in git)\n>\n> - In your first patch you wrote:\n>> The detectRenames option should be set to the desired threshold value.\n> I'm not sure what threshold value you refer to here, and what values\n> you can set it to. Am I missing something?\n> (I'm not very familiar with git rename detection options)\n>\n> I'm a git-p4 user, so I can test your changes and look a bit more at\n> your code. Someone verifying it could help getting the patches\n> applied.\n>\n> Thanks for improving git-p4!\n>\n> Cheers,\n> Thomas Berg\n>\n\n\n\n-- \nVitor Antunes\n"},{"id":"160075","messageId":"AANLkTi=PPN69uuJmUBDHKtmn59DzUbdk=Qu4Ug-kok89@mail.gmail.com","threadId":"25784","inReplyTo":"AANLkTimLQxiB=dnd6=iB5uEpzOSfqks=FDJ=xORehuw8@mail.gmail.com","subject":"Re: [PATCH] git-p4: Corrected typo.","fromName":"Vitor Antunes","fromEmail":"vitor.hda@gmail.com","sentAt":"2011-01-30T23:21:50Z","receivedAt":"2011-01-30T23:21:50Z","isPatch":true,"sender":{"key":"vitor.hda@gmail.com","avatar":"https://avatars.githubusercontent.com/u/606876?v=4"},"body":"Hi Thomas,\n\nI've just sent out the patches to the mailing list. I'm looking\nforward to receive some feedback from you :)\n\nI also have some branch detection related patch prepared. Do you use\nthis feature often?\n\nThanks,\nVitor\n\nOn Sat, Jan 29, 2011 at 2:41 AM, Vitor Antunes <vitor.hda@gmail.com> wrote:\n> Hi Thomas,\n>\n> First of all I'd like to thank you on your feedback. It's my first try\n> on creating submitting a patch, so having someone's guidance helps a\n> lot :)\n>\n> I'll rebase my patches against the head of the tree and squash the fix\n> to avoid multiple commits. While I do that I'll also review my commit\n> message and sign-off the patches according to what you said. Hopefully\n> I will be able to do this during this weekend.\n>\n> From git-diff-tree man page:\n>\n> \"\"\"\n> -M[<n>]\n>    Detect renames. If n is specified, it is a is a threshold on the\n> similarity index (i.e. amount of addition/deletions compared to the\n> file’s\n>    size). For example, -M90% means git should consider a delete/add\n> pair to be a rename if more than 90% of the file hasn’t changed.\n> \"\"\"\n>\n> But from my latest tests I think that this option is ignored in\n> diff-tree (I think it's only used in git log). With this in mind I'll\n> need to add some code to implement the check of the score value of\n> diff-tree output string. Again from its man page:\n>\n> \"\"\"\n> Status letters C and R are always followed by a score (denoting the\n> percentage of similarity between the source and target of the move or\n> copy), and are the only ones to be so.\n> \"\"\"\n>\n> Thanks,\n> Vitor\n>\n> On Fri, Jan 28, 2011 at 3:19 PM, Thomas Berg <merlin66b@gmail.com> wrote:\n>> Hi,\n>>\n>> On Fri, Jan 28, 2011 at 12:35 AM, Vitor Antunes <vitor.hda@gmail.com> wrote:\n>>> Hi everyone,\n>>>\n>>> Could anyone comment the 3 patches I sent (being this the last one)?\n>>>\n>> [...]\n>>> On Thu, Nov 25, 2010 at 1:26 AM, Vitor Antunes <vitor.hda@gmail.com> wrote:\n>>>> ---\n>>>>  contrib/fast-import/git-p4 |    2 +-\n>>>>  1 files changed, 1 insertions(+), 1 deletions(-)\n>>>>\n>>>> diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4\n>>>> index 0ea3a44..a466847 100755\n>>>> --- a/contrib/fast-import/git-p4\n>>>> +++ b/contrib/fast-import/git-p4\n>>>> @@ -618,7 +618,7 @@ class P4Submit(Command):\n>>>>         if len(detectRenames) > 0:\n>>>>             diffOpts = \"-M%s\" % detectRenames\n>>>>         else:\n>>>> -            diffOpts = (\"\", \"-M\")[self.detectRenames]\n>>>> +            diffOpts = (\"\", \"-M\")[self.detectRename]\n>>>>\n>>\n>> This appears to me to be a bugfix for one of the other patches you\n>> sent, is that right?\n>>\n>> If so, maybe you could squash it with the previous patch and re-send\n>> it all to the list?\n>>\n>> My other comments for now are:\n>> - you have forgotten to sign off on the patches\n>> - commit messages are normally in imperative rather than past tense\n>> (see Documentation/SubmittingPatches in git)\n>>\n>> - In your first patch you wrote:\n>>> The detectRenames option should be set to the desired threshold value.\n>> I'm not sure what threshold value you refer to here, and what values\n>> you can set it to. Am I missing something?\n>> (I'm not very familiar with git rename detection options)\n>>\n>> I'm a git-p4 user, so I can test your changes and look a bit more at\n>> your code. Someone verifying it could help getting the patches\n>> applied.\n>>\n>> Thanks for improving git-p4!\n>>\n>> Cheers,\n>> Thomas Berg\n>>\n>\n>\n>\n> --\n> Vitor Antunes\n>\n\n\n\n-- \nVitor Antunes\n"},{"id":"160076","messageId":"AANLkTi=kmcWn9WWbhA4bMZ5bEo1imacEugT0BcOU9jry@mail.gmail.com","threadId":"25784","inReplyTo":"AANLkTi=PPN69uuJmUBDHKtmn59DzUbdk=Qu4Ug-kok89@mail.gmail.com","subject":"Re: [PATCH] git-p4: Corrected typo.","fromName":"Thomas Berg","fromEmail":"merlin66b@gmail.com","sentAt":"2011-01-30T23:34:44Z","receivedAt":"2011-01-30T23:34:44Z","isPatch":true,"sender":{"key":"merlin66b@gmail.com","avatar":null},"body":"Hi Vitor,\n\nOn Mon, Jan 31, 2011 at 12:21 AM, Vitor Antunes <vitor.hda@gmail.com> wrote:\n> Hi Thomas,\n>\n> I've just sent out the patches to the mailing list. I'm looking\n> forward to receive some feedback from you :)\n\nThanks, I will try to get it tested tomorrow.\n\nBy the way, on this mailing list please don't top post. I think the\npreferred style is interleaved posting:\nhttp://en.wikipedia.org/wiki/Posting_style#Interleaved_style\n\n>\n> I also have some branch detection related patch prepared. Do you use\n> this feature often?\n\nNo, the Perforce repo I work with is so non-standard that the only\nsolution has been to import all the branches separately and graft the\nhistory together. This covers all my needs at the moment.\n\nCheers,\nThomas\n"},{"id":"160090","messageId":"AANLkTinCL6+oTAbh4WpsWHx8cZ8cxZvQxSO9EX_xsHh0@mail.gmail.com","threadId":"25784","inReplyTo":"AANLkTi=kmcWn9WWbhA4bMZ5bEo1imacEugT0BcOU9jry@mail.gmail.com","subject":"Re: [PATCH] git-p4: Corrected typo.","fromName":"Vitor Antunes","fromEmail":"vitor.hda@gmail.com","sentAt":"2011-01-31T11:25:30Z","receivedAt":"2011-01-31T11:25:30Z","isPatch":true,"sender":{"key":"vitor.hda@gmail.com","avatar":"https://avatars.githubusercontent.com/u/606876?v=4"},"body":"Hi Thomas,\n\nOn Sun, Jan 30, 2011 at 11:34 PM, Thomas Berg <merlin66b@gmail.com> wrote:\n> By the way, on this mailing list please don't top post. I think the\n> preferred style is interleaved posting:\n> http://en.wikipedia.org/wiki/Posting_style#Interleaved_style\n\nThanks for introducing me to these \"rules\" that are being used within\nthe git community :)\n\n>> I also have some branch detection related patch prepared. Do you use\n>> this feature often?\n>\n> No, the Perforce repo I work with is so non-standard that the only\n> solution has been to import all the branches separately and graft the\n> history together. This covers all my needs at the moment.\n\nMaybe I'm not seeing some obvious limitation, but I can't imagine a\nbranching structure that can't be imported into git. Could please you\ngive me an example?\n\nThanks,\n\n-- \nVitor Antunes\n"},{"id":"160091","messageId":"AANLkTinrALdy9w7K50r=k-oMV9V5+7+LKvui_DSmJ6nK@mail.gmail.com","threadId":"25784","inReplyTo":"AANLkTinCL6+oTAbh4WpsWHx8cZ8cxZvQxSO9EX_xsHh0@mail.gmail.com","subject":"Re: [PATCH] git-p4: Corrected typo.","fromName":"Thomas Berg","fromEmail":"merlin66b@gmail.com","sentAt":"2011-01-31T12:51:07Z","receivedAt":"2011-01-31T12:51:07Z","isPatch":true,"sender":{"key":"merlin66b@gmail.com","avatar":null},"body":"Hi Vitor,\n\nOn Mon, Jan 31, 2011 at 12:25 PM, Vitor Antunes <vitor.hda@gmail.com> wrote:\n>> No, the Perforce repo I work with is so non-standard that the only\n>> solution has been to import all the branches separately and graft the\n>> history together. This covers all my needs at the moment.\n>\n> Maybe I'm not seeing some obvious limitation, but I can't imagine a\n> branching structure that can't be imported into git. Could please you\n> give me an example?\n\nHere I was thinking of the fact that git-p4 (last time I checked the\nimplementation ) uses the list of branch specs in Perforce for\nfiguring out the parent of a branch. Our branch specs have changed\nover time (they are used for different integration purposes), so they\nare no longer usable for this purpose.\n\nI also discovered bugs in git-p4: in some cases, if the first submit\nto a new branch in Perforce is not identical to the branch it derives\nfrom, the import was not correct.\n\nOne other issue with Perforce, CVS and many other systems is that they\nbranch per file. Therefore Perforce can represent partial merges\nbetween two branches, which git cannot. Because of this, translating\nmerges in Perforce to merges in git is not always possible or\ndesirable:\n- if you integrate just one file from one branch to another in\nPerforce, and leave the rest unmerged, you probably want to represent\nit as a normal git commit (not a merge)\n- if you merge almost everything, but leave out a file for some\nreason, you may still want to represent it as a merge in git\n\nThe git-p4raw tool has excellent handling of merges, see details in\nthis file around line 4300:\nhttps://github.com/samv/git-p4raw/blob/master/git-p4raw\nIt supports several algorithms for automatic merge detection, as well\nas manually changing it after the import is done.\n\nCheers,\nThomas\n"},{"id":"160093","messageId":"AANLkTinKQRfwaMpGQiDCkh1RerQ_MrakwvNLAqgmbF9A@mail.gmail.com","threadId":"25784","inReplyTo":"AANLkTinrALdy9w7K50r=k-oMV9V5+7+LKvui_DSmJ6nK@mail.gmail.com","subject":"Re: [PATCH] git-p4: Corrected typo.","fromName":"Vitor Antunes","fromEmail":"vitor.hda@gmail.com","sentAt":"2011-01-31T13:39:27Z","receivedAt":"2011-01-31T13:39:27Z","isPatch":true,"sender":{"key":"vitor.hda@gmail.com","avatar":"https://avatars.githubusercontent.com/u/606876?v=4"},"body":"Hi Thomas,\n\nOn Mon, Jan 31, 2011 at 12:51 PM, Thomas Berg <merlin66b@gmail.com> wrote:\n>> Maybe I'm not seeing some obvious limitation, but I can't imagine a\n>> branching structure that can't be imported into git. Could please you\n>> give me an example?\n>\n> Here I was thinking of the fact that git-p4 (last time I checked the\n> implementation ) uses the list of branch specs in Perforce for\n> figuring out the parent of a branch. Our branch specs have changed\n> over time (they are used for different integration purposes), so they\n> are no longer usable for this purpose.\n\nMy personal git-p4 script uses a configuration option to define the\nlist of branches. I also added an option to get the list of branches\nfiltered by user (p4 branches -u), which avoids waiting for the server\nsince I don't have any branches defined.\n\n> I also discovered bugs in git-p4: in some cases, if the first submit\n> to a new branch in Perforce is not identical to the branch it derives\n> from, the import was not correct.\n\nAnother thing that I modified was the following lines:\n\n1559                         for (prev, cur) in\nzip(self.previousDepotPaths, depotPaths):\n1560                             for i in range(0, min(len(cur), len(prev))):\n1561                                 if cur[i] <> prev[i]:\n1562                                     i = i - 1\n1563                                     break\n\nThis tries to find the root directory of all branches, but does that\ncomparing char by char. So, if you have something like:\n\n//depot/branches/branch\n//depot/branches/branch_test1\n//depot/branches/branch_test2\n\nIt will assume that your root branch is //depot/branches/branch, which is wrong.\nI've modified this to split the string by \"/\" and compare those items,\nmaking sure it will detect //depot/branches as the root directory.\n\n> One other issue with Perforce, CVS and many other systems is that they\n> branch per file. Therefore Perforce can represent partial merges\n> between two branches, which git cannot. Because of this, translating\n> merges in Perforce to merges in git is not always possible or\n> desirable:\n> - if you integrate just one file from one branch to another in\n> Perforce, and leave the rest unmerged, you probably want to represent\n> it as a normal git commit (not a merge)\n> - if you merge almost everything, but leave out a file for some\n> reason, you may still want to represent it as a merge in git\n\nYes, merge detection is something that is working. I never tried to\nlook into this because I don't find it too important for my work flow.\n\n> The git-p4raw tool has excellent handling of merges, see details in\n> this file around line 4300:\n> https://github.com/samv/git-p4raw/blob/master/git-p4raw\n> It supports several algorithms for automatic merge detection, as well\n> as manually changing it after the import is done.\n\nI'll have to look into this later :)\n\nBye,\n-- \nVitor Antunes\n"},{"id":"160095","messageId":"AANLkTin5yR84x=3Qb3W9bZYhUHwbcrhf60Z1CwHyYHOL@mail.gmail.com","threadId":"25784","inReplyTo":"AANLkTinKQRfwaMpGQiDCkh1RerQ_MrakwvNLAqgmbF9A@mail.gmail.com","subject":"Re: [PATCH] git-p4: Corrected typo.","fromName":"Vitor Antunes","fromEmail":"vitor.hda@gmail.com","sentAt":"2011-01-31T15:54:32Z","receivedAt":"2011-01-31T15:54:32Z","isPatch":true,"sender":{"key":"vitor.hda@gmail.com","avatar":"https://avatars.githubusercontent.com/u/606876?v=4"},"body":"Hi Thomas,\n\n> On Mon, Jan 31, 2011 at 12:51 PM, Thomas Berg <merlin66b@gmail.com> wrote:\n>> I also discovered bugs in git-p4: in some cases, if the first submit\n>> to a new branch in Perforce is not identical to the branch it derives\n>> from, the import was not correct.\n\nI forgot to answer this specific topic. I also noticed this bug.\nBasically, git-p4 choses the first commit from the origin branch to\nstart the branch from. My idea was to walk through the commit tree in\nthe original branch until I find a commit in which the diff is null.\nUnfortunately, I don't know what is the best approach to achieve this\nin git. Do you have any ideas?\n\nThanks,\n-- \nVitor Antunes\n"},{"id":"160382","messageId":"AANLkTinO02E1GrMjb1J5gQTOhGYf8QsnABU_1ehQonDX@mail.gmail.com","threadId":"25784","inReplyTo":"AANLkTin5yR84x=3Qb3W9bZYhUHwbcrhf60Z1CwHyYHOL@mail.gmail.com","subject":"Re: [PATCH] git-p4: Corrected typo.","fromName":"Thomas Berg","fromEmail":"merlin66b@gmail.com","sentAt":"2011-02-04T08:59:07Z","receivedAt":"2011-02-04T08:59:07Z","isPatch":true,"sender":{"key":"merlin66b@gmail.com","avatar":null},"body":"On Mon, Jan 31, 2011 at 4:54 PM, Vitor Antunes <vitor.hda@gmail.com> wrote:\n> Hi Thomas,\n>\n>> On Mon, Jan 31, 2011 at 12:51 PM, Thomas Berg <merlin66b@gmail.com> wrote:\n>>> I also discovered bugs in git-p4: in some cases, if the first submit\n>>> to a new branch in Perforce is not identical to the branch it derives\n>>> from, the import was not correct.\n>\n> I forgot to answer this specific topic. I also noticed this bug.\n> Basically, git-p4 choses the first commit from the origin branch to\n> start the branch from. My idea was to walk through the commit tree in\n> the original branch until I find a commit in which the diff is null.\n> Unfortunately, I don't know what is the best approach to achieve this\n> in git. Do you have any ideas?\n\nThe thing is that the diff doesn't have to be null either, if an\n\"evil\" branching has happened  - the submit that creates the new\nbranch contains a different tree than the source branch. It would\nprobably work well in most cases though, you could just fall back to\nthe current behaviour if no zero-diff parent is found. I'm sure it's\neasy with some git plumbing commands, but I'm of little help there.\n\nI haven't had time to test your patches yet, hope to get some time soon...\n\nCheers,\nThomas\n"}]}