Jump to content


merge or rebase with DVCS

dvcs

  • Please log in to reply
5 replies to this topic

#1 Kei Son

Kei Son

    Advanced Member

  • Members
  • PipPipPip
  • 46 posts

Posted 20 May 2015 - 11:42 PM

Regarding some of your articles about DVCS, I understand that I can achieve git-style rebase with modifying submit history and also merge. However, it might be impossible by the perforce's changelist concept that there is no way to get my local history alive after merge.

But, is it right? No way? Or any plan?

Posted Image

#2 P4Sam

P4Sam

    Advanced Member

  • Members
  • PipPipPip
  • 484 posts
  • LocationSan Francisco, CA

Posted 21 May 2015 - 02:30 AM

View PostKei Son, on 20 May 2015 - 11:42 PM, said:

However, it might be impossible by the perforce's changelist concept that there is no way to get my local history alive after merge.

Could you explain this a little more?  What do you mean by "local history alive"?  (An example might help me...)

#3 Kei Son

Kei Son

    Advanced Member

  • Members
  • PipPipPip
  • 46 posts

Posted 21 May 2015 - 04:37 AM

It can be described by the top - right graph in the above images; merge and keep the local history.

#4 P4Sam

P4Sam

    Advanced Member

  • Members
  • PipPipPip
  • 484 posts
  • LocationSan Francisco, CA

Posted 21 May 2015 - 04:40 AM

When you do a merge on a local Perforce server, you do have all the history locally, which is why I'm confused on what you mean by "local history".  Could you step me through an example of what you're doing in Perforce and what you're not seeing that you would like to be seeing?

#5 Kei Son

Kei Son

    Advanced Member

  • Members
  • PipPipPip
  • 46 posts

Posted 21 May 2015 - 05:41 AM

Oh, wait. I completely wrong. I'd like to make the question correctly:

Let's say there is a repository A at shared server:

1. Clone into my localhost
2. Create a stream B from A to fix things
3. Submit three changes that meanings I have a history in my local server
4. Merge it into A
5. Push
6. Delete stream B because it has done with its purpose

In this situation, I have no history of my changes, but only a message like "merged from B" something like that. Right? I want to know there is a way I can keep my history alive through a merging case like Git does.

#6 P4Sam

P4Sam

    Advanced Member

  • Members
  • PipPipPip
  • 484 posts
  • LocationSan Francisco, CA

Posted 21 May 2015 - 04:52 PM

Essentially what you want to do is merge each changelist individually and copy the description over to the target stream, 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.worksh...s/deepimport.pl





Also tagged with one or more of these keywords: dvcs

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users