[p4] merge or rebase with DVCS

P4Sam perforce-user-forum at forums.perforce.com
Thu May 21 09:55:01 PDT 2015


Posted on behalf of forum user 'P4Sam'.

Essentially what you want to do is merge each changelist individually and copy
the description over to the target branch, which would look something like
(pseudocode):

for each CHANGE in "p4 interchanges B/... A/..."
    p4 merge B/...@=CHANGE A/...
    p4 resolve -am
    p4 submit -d "CHANGE DESC"

If you do a single merge command you end up with a single changelist, but the
ability to specify a revision range gives you a lot of flexibility; you can
merge each change individually, you can group them into larger changes as you
merge, you can do them in different orders, you can cherry-pick some and ignore
others, etc. 

There isn't a one-shot command to do the individual-change case described
above (yet -- the "resubmit" command does something really similar in
terms of automating multiple resolve/submit steps for you, but currently
it's only used for handling fetch conflicts), so if this were a common
operation you'd want to script it.

Actually, come to think of it I wrote a script some years back that would
probably do the trick -- it was originally intended as a way to migrate history
between remote depots (to deal with the problem of not being able to readily
access remote depot history from a local depot), but that carries over into the
DVCS setup quite well.  (See comments in the script about being able
to use a local depot rather than a remote depot -- that's how you'd use
it in this case.)    
https://swarm.workshop.perforce.com/files/guest/sam_stafford/scripts/deepimport.pl



--
Please click here to see the post in its original format:
  http://forums.perforce.com/index.php?/topic/4101-merge-or-rebase-with-dvcs



More information about the perforce-user mailing list