{"thread":{"id":"17418","subject":"[PATCH] git-p4: avoid syncing duplicate changes","startedAt":"2009-01-28T16:45:40Z","lastAt":"2009-02-23T17:08:10Z","messageCount":4,"participants":["Pete Wyckoff","Simon Hausmann"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"102323","messageId":"20090128164540.GA2137@padd.com","threadId":"17418","inReplyTo":null,"subject":"[PATCH] git-p4: avoid syncing duplicate changes","fromName":"Pete Wyckoff","fromEmail":"pw@padd.com","sentAt":"2009-01-28T16:45:40Z","receivedAt":"2009-01-28T16:45:40Z","isPatch":true,"sender":{"key":"pw@padd.com","avatar":null},"body":"When a particular changeset affects multiple depot paths, it\nwill appear multiple times in the output of \"p4 changes\".\nFilter out the duplicates to avoid the extra empty commits that\nthis would otherwise create.\n\nSigned-off-by: Pete Wyckoff <pw@padd.com>\n---\n contrib/fast-import/git-p4 |    5 +++--\n 1 files changed, 3 insertions(+), 2 deletions(-)\n\ndiff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4\nindex a85a7b2..63c8eca 100755\n--- a/contrib/fast-import/git-p4\n+++ b/contrib/fast-import/git-p4\n@@ -444,8 +444,9 @@ def p4ChangesForPaths(depotPaths, changeRange):\n \n     changes = []\n     for line in output:\n-        changeNum = line.split(\" \")[1]\n-        changes.append(int(changeNum))\n+\tchangeNum = int(line.split(\" \")[1])\n+\tif changeNum not in changes:\n+\t    changes.append(changeNum)\n \n     changes.sort()\n     return changes\n-- \n1.6.0.6\n"},{"id":"103341","messageId":"200902051624.51636.simon@lst.de","threadId":"17418","inReplyTo":"20090128164540.GA2137@padd.com","subject":"Re: [PATCH] git-p4: avoid syncing duplicate changes","fromName":"Simon Hausmann","fromEmail":"simon@lst.de","sentAt":"2009-02-05T15:24:51Z","receivedAt":"2009-02-05T15:24:51Z","isPatch":true,"sender":{"key":"hausmann@kde.org","avatar":"https://gravatar.com/avatar/bc9aad4fb31dce17eb66e690e7b51fe980c62da3c225c785da35dd806b8da778?d=mp&s=160"},"body":"On Wednesday 28 January 2009 Pete Wyckoff, wrote:\n> When a particular changeset affects multiple depot paths, it\n> will appear multiple times in the output of \"p4 changes\".\n> Filter out the duplicates to avoid the extra empty commits that\n> this would otherwise create.\n> \n> Signed-off-by: Pete Wyckoff <pw@padd.com>\n> ---\n>  contrib/fast-import/git-p4 |    5 +++--\n>  1 files changed, 3 insertions(+), 2 deletions(-)\n> \n> diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4\n> index a85a7b2..63c8eca 100755\n> --- a/contrib/fast-import/git-p4\n> +++ b/contrib/fast-import/git-p4\n> @@ -444,8 +444,9 @@ def p4ChangesForPaths(depotPaths, changeRange):\n>  \n>      changes = []\n>      for line in output:\n> -        changeNum = line.split(\" \")[1]\n> -        changes.append(int(changeNum))\n> +\tchangeNum = int(line.split(\" \")[1])\n> +\tif changeNum not in changes:\n> +\t    changes.append(changeNum)\n\nHmm, isn't this a potentially quadratic operation?\n\nI agree about the problem in general though.\n\nSimon\n"},{"id":"105330","messageId":"20090218181214.GA21970@padd.com","threadId":"17418","inReplyTo":"200902051624.51636.simon@lst.de","subject":"[PATCH v2] git-p4: avoid syncing duplicate changes","fromName":"Pete Wyckoff","fromEmail":"pw@padd.com","sentAt":"2009-02-18T18:12:14Z","receivedAt":"2009-02-18T18:12:14Z","isPatch":true,"sender":{"key":"pw@padd.com","avatar":null},"body":"When a particular changeset affects multiple depot paths, it\nwill appear multiple times in the output of \"p4 changes\".\nFilter out the duplicates to avoid the extra empty commits that\nthis otherwise would create.\n\nSigned-off-by: Pete Wyckoff <pw@padd.com>\n---\nSwitched to a dictionary to avoid the quadratic behavior,\nas pointed out by Simon.\n\n contrib/fast-import/git-p4 |   11 ++++++-----\n 1 files changed, 6 insertions(+), 5 deletions(-)\n\ndiff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4\nindex a85a7b2..3832f60 100755\n--- a/contrib/fast-import/git-p4\n+++ b/contrib/fast-import/git-p4\n@@ -442,13 +442,14 @@ def p4ChangesForPaths(depotPaths, changeRange):\n     output = p4_read_pipe_lines(\"changes \" + ' '.join ([\"%s...%s\" % (p, changeRange)\n                                                         for p in depotPaths]))\n \n-    changes = []\n+    changes = {}\n     for line in output:\n-        changeNum = line.split(\" \")[1]\n-        changes.append(int(changeNum))\n+\tchangeNum = int(line.split(\" \")[1])\n+\tchanges[changeNum] = True\n \n-    changes.sort()\n-    return changes\n+    changelist = changes.keys()\n+    changelist.sort()\n+    return changelist\n \n class Command:\n     def __init__(self):\n-- \n1.6.0.6\n"},{"id":"105921","messageId":"200902231808.11072.simon@lst.de","threadId":"17418","inReplyTo":"20090218181214.GA21970@padd.com","subject":"Re: [PATCH v2] git-p4: avoid syncing duplicate changes","fromName":"Simon Hausmann","fromEmail":"simon@lst.de","sentAt":"2009-02-23T17:08:10Z","receivedAt":"2009-02-23T17:08:10Z","isPatch":true,"sender":{"key":"hausmann@kde.org","avatar":"https://gravatar.com/avatar/bc9aad4fb31dce17eb66e690e7b51fe980c62da3c225c785da35dd806b8da778?d=mp&s=160"},"body":"On Wednesday 18 February 2009 Pete Wyckoff, wrote:\n> When a particular changeset affects multiple depot paths, it\n> will appear multiple times in the output of \"p4 changes\".\n> Filter out the duplicates to avoid the extra empty commits that\n> this otherwise would create.\n> \n> Signed-off-by: Pete Wyckoff <pw@padd.com>\n\nAcked-by: Simon Hausmann <simon@lst.de>\n\n\nNice patch, thanks :)\n\nSimon\n\n> Switched to a dictionary to avoid the quadratic behavior,\n> as pointed out by Simon.\n> \n>  contrib/fast-import/git-p4 |   11 ++++++-----\n>  1 files changed, 6 insertions(+), 5 deletions(-)\n> \n> diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4\n> index a85a7b2..3832f60 100755\n> --- a/contrib/fast-import/git-p4\n> +++ b/contrib/fast-import/git-p4\n> @@ -442,13 +442,14 @@ def p4ChangesForPaths(depotPaths, changeRange):\n>      output = p4_read_pipe_lines(\"changes \" + ' '.join ([\"%s...%s\" % (p, \nchangeRange)\n>                                                          for p in \ndepotPaths]))\n>  \n> -    changes = []\n> +    changes = {}\n>      for line in output:\n> -        changeNum = line.split(\" \")[1]\n> -        changes.append(int(changeNum))\n> +\tchangeNum = int(line.split(\" \")[1])\n> +\tchanges[changeNum] = True\n>  \n> -    changes.sort()\n> -    return changes\n> +    changelist = changes.keys()\n> +    changelist.sort()\n> +    return changelist\n>  \n>  class Command:\n>      def __init__(self):\n> -- \n> 1.6.0.6\n> \n> \n"}]}