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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxx>

Acked-by: Simon Hausmann <simon@xxxxxx>


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
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux