git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2] git-p4: avoid syncing duplicate changes

From
Simon Hausmann <simon@lst.de>
Date
Feb 23, 2009, 17:08 UTC
Message-ID
<200902231808.11072.simon@lst.de>
In-Reply-To
<20090218181214.GA21970@padd.com>
On Wednesday 18 February 2009 Pete Wyckoff, wrote:
Show 6 quoted lines
> When a particular changeset affects multiple depot paths, it
> will appear multiple times in the output of "p4 changes".
> Filter out the duplicates to avoid the extra empty commits that
> this otherwise would create.
> 
> Signed-off-by: Pete Wyckoff <pw@padd.com>
Acked-by: Simon Hausmann <simon@lst.de>
Nice patch, thanks :)
Simon
Show 12 quoted lines
> Switched to a dictionary to avoid the quadratic behavior,
> as pointed out by Simon.
> 
>  contrib/fast-import/git-p4 |   11 ++++++-----
>  1 files changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
> index a85a7b2..3832f60 100755
> --- a/contrib/fast-import/git-p4
> +++ b/contrib/fast-import/git-p4
> @@ -442,13 +442,14 @@ def p4ChangesForPaths(depotPaths, changeRange):
>      output = p4_read_pipe_lines("changes " + ' '.join (["%s...%s" % (p, 
changeRange)
>                                                          for p in 
depotPaths]))
Show 21 quoted lines
>  
> -    changes = []
> +    changes = {}
>      for line in output:
> -        changeNum = line.split(" ")[1]
> -        changes.append(int(changeNum))
> +	changeNum = int(line.split(" ")[1])
> +	changes[changeNum] = True
>  
> -    changes.sort()
> -    return changes
> +    changelist = changes.keys()
> +    changelist.sort()
> +    return changelist
>  
>  class Command:
>      def __init__(self):
> -- 
> 1.6.0.6
> 
> 
Previous: Pete Wyckoff
Message 4 of 4 in “git-p4: avoid syncing duplicate changes”
  1. git-p4: avoid syncing duplicate changesPete Wyckoff, Jan 28, 2009
  2. Simon HausmannFeb 5, 2009
  3. git-p4: avoid syncing duplicate changesPete Wyckoff, Feb 18, 2009
  4. Simon HausmannFeb 23, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.