Issue1301

Title Rebasing multiple changes requires redundant merges
Priority bug Status resolved
Superseder unnecessary merge conflicts in rebase
View: 1561
Nosy List astratto, bsmedberg, cboos, djc, mpm
Assigned To astratto Topics

Created on 2008-09-16.13:46:52 by bsmedberg, last changed 2009-11-25.14:02:56 by cboos.

Files
File name Uploaded Type Edit Remove
avoid_redundant_merges.patch astratto, 2008-10-21.20:07:59 text/x-diff
current_behavior.txt astratto, 2008-09-18.09:41:03 text/plain
rebase-merging2.sh bsmedberg, 2008-09-16.13:48:21 application/x-shellscript
Messages
msg11071 (view) Author: cboos Date: 2009-11-25.14:02:56
(back to resolved)
msg11070 (view) Author: cboos Date: 2009-11-25.13:03:23
For the record, this was not complete, see follow-up issue1561.

There, the failing test (test-rebase-collapse) mentioned in msg7626 was also 
fixed.
msg7697 (view) Author: djc Date: 2008-10-29.11:21:52
This should be fixed in, in main: http://www.selenic.com/hg/rev/45495d784ad6
msg7635 (view) Author: astratto Date: 2008-10-21.20:07:59
Yes you're right.
As you can see test-rebase-collapse fails, it seems like it just forgets about
the previous merges.
I'll investigate further on this as soon as possible.
msg7629 (view) Author: djc Date: 2008-10-21.17:37:35
Putting your patch out there (that is, here, or on the devel list) would be a
good thing regardless.
msg7626 (view) Author: astratto Date: 2008-10-21.16:11:02
I'm working on this but I still have a failing test (test-rebase-collapse)
without being able to understand why it fails.
If someone wants to help me with this issue I could upload the current patch
somewhere (e.g., here).
msg7615 (view) Author: djc Date: 2008-10-21.09:29:14
This is now one of a few things blocking a release. What can we do to fix this?
msg7161 (view) Author: astratto Date: 2008-09-18.09:41:03
I've tried to wrap ancestor.ancestor when we actually merge and it seems to work.
The problem is define correctly which ancestor should be returned.
In most cases we want to return the parent of the node that's going to be
rebased, but what if that node had two parents (f in your second case)?

I've attached a file to describe the current behavior.
To sum up...
rebase e onto b means:
- update to b
- merge with e
- setparents(b, -1)
In the second step ancestor.ancestor returns correctly a.
For f onto e' it returns a, but should return e.
msg7158 (view) Author: mpm Date: 2008-09-17.21:32:29
'virtual parent' here means that e is a parent of e' even though rebase erases
that information with setparents. So when we merge f, we need to somehow make
our ancestor code find e rather than a, probably by wrapping it.
msg7152 (view) Author: djc Date: 2008-09-16.17:06:47
mpm pasted this into the pastebin:

a-b
 \
  e-f

a-b-c-d-e'
 \   .-'
  \ /
   e-f

when we go to rebase f to f', we merge e' and f with a 'virtual parent' of e.

a-b
 \
  c-d-f-g
   \ /
    e

rebase c onto b...

a-b-c'-d'
 \    \  
  \    e'
   \
    c-d-f-g
     \ /
      e

f' = merge(d', f) with ancestor d

a-b-c'-d'-f'
 \    \  /
  \    e'
   \
    c-d-f-g
     \ /
      e

when we rebase g onto f', we have to remember that f is really an ancestor of f'
and should be the base for merge(f', g)
msg7150 (view) Author: djc Date: 2008-09-16.13:51:00
astratto, would this be easy to fix?
msg7149 (view) Author: bsmedberg Date: 2008-09-16.13:46:51
I frequently want to rebase a branch of multiple patches forward. This works
well if there are no conflicts. But if there are conflicts in the first rebased
change, all the subsequent rebasings require me to resolve the same conflict
over and over again, even if the subsequent changes don't touch the conflicting
file at all.

The same kind of workflow with hg qpush -m doesn't have this problem.

Testcase .sh script attached
History
Date User Action Args
2009-11-25 14:02:56cboossetstatus: chatting -> resolved
nosy: mpm, cboos, djc, astratto, bsmedberg
messages: + msg11071
2009-11-25 13:03:23cboossetstatus: resolved -> chatting
superseder: + unnecessary merge conflicts in rebase
messages: + msg11070
nosy: + cboos
2008-10-29 11:21:53djcsetstatus: in-progress -> resolved
messages: + msg7697
2008-10-28 18:45:33astrattosetstatus: chatting -> in-progress
2008-10-21 20:07:59astrattosetfiles: + avoid_redundant_merges.patch
messages: + msg7635
2008-10-21 17:37:35djcsetmessages: + msg7629
2008-10-21 16:11:02astrattosetmessages: + msg7626
2008-10-21 09:29:14djcsetmessages: + msg7615
2008-10-15 18:35:58astrattosetassignedto: astratto
2008-09-18 09:41:06astrattosetfiles: + current_behavior.txt
messages: + msg7161
2008-09-17 21:32:30mpmsetmessages: + msg7158
2008-09-16 17:06:49djcsetnosy: + mpm
messages: + msg7152
2008-09-16 13:51:01djcsetstatus: unread -> chatting
nosy: + astratto, djc
messages: + msg7150
2008-09-16 13:48:21bsmedbergsetfiles: + rebase-merging2.sh
2008-09-16 13:46:52bsmedbergcreate