All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Hausmann <simon@lst.de>
To: Pete Wyckoff <pw@padd.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH v2] git-p4: avoid syncing duplicate changes
Date: Mon, 23 Feb 2009 18:08:10 +0100	[thread overview]
Message-ID: <200902231808.11072.simon@lst.de> (raw)
In-Reply-To: <20090218181214.GA21970@padd.com>

On Wednesday 18 February 2009 Pete Wyckoff, wrote:
> 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

> 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]))
>  
> -    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
> 
> 

      reply	other threads:[~2009-02-23 17:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-28 16:45 [PATCH] git-p4: avoid syncing duplicate changes Pete Wyckoff
2009-02-05 15:24 ` Simon Hausmann
2009-02-18 18:12   ` [PATCH v2] " Pete Wyckoff
2009-02-23 17:08     ` Simon Hausmann [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200902231808.11072.simon@lst.de \
    --to=simon@lst.de \
    --cc=git@vger.kernel.org \
    --cc=pw@padd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.