git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Bug: git-p4 can generate duplicate commits when syncing changes that span multiple depot paths
@ 2016-09-08 21:41 James Farwell
  0 siblings, 0 replies; only message in thread
From: James Farwell @ 2016-09-08 21:41 UTC (permalink / raw)
  To: git@vger.kernel.org

Reproduction Steps:

1. Have a git repo cloned from a perforce repo using multiple depot paths (e.g. //depot/foo and //depot/bar).
2. Submit a single change to the perforce repo that makes changes in both //depot/foo and //depot/bar.
3. Run "git p4 sync" to sync the change from #2.


Expected Behavior:

Change should be synced as a single commit to the git repo.


Actual Behavior:

Change is synced as multiple commits, one for each depot path that was affected.


Best Guess:

I believe this is happening because the command syntax "p4 changes //depot/foo/...@123,456 //depot/bar/...@123,456", which git-p4 uses to get the list of changes to sync, will return the same change number multiple times if the change was present in multiple depot paths. This is expected behavior as per the p4 changes documentation: "If p4 changes is called with multiple file arguments, the sets of changelists that affect each argument are evaluated individually. The final output is neither combined nor sorted; the effect is the same as calling p4 changes multiple times, once for each file argument." git-p4 is handling the sorting itself, but it is not handling the combining.

I would imagine this is fixable in the p4ChangesForPaths() method by dropping non-unique elements of the list before or after sorting. Rudimentary testing in the python interpreter would suggest that something like "changes = sorted(set(changes))" should do the trick, but I am no python expert so there may be a better way.


Thanks!
- James

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-09-08 21:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-08 21:41 Bug: git-p4 can generate duplicate commits when syncing changes that span multiple depot paths James Farwell

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).