rebase: treat nullmerge as a special case in rebasestate (issue3046)

When storing/restoring a nullmerge (-2), a 'standard' conversion was made
and an existing changeset was wrongly used.
Nullmerge should instead be treated as a special case.
This commit is contained in:
Stefano Tortarolo 2011-11-06 23:35:33 +01:00
parent a179a7e151
commit 822926675c
2 changed files with 46 additions and 2 deletions

View File

@ -479,7 +479,10 @@ def storestatus(repo, originalwd, target, state, collapse, keep, keepbranches,
f.write('%d\n' % int(keepbranches))
for d, v in state.iteritems():
oldrev = repo[d].hex()
newrev = repo[v].hex()
if v != nullmerge:
newrev = repo[v].hex()
else:
newrev = v
f.write("%s:%s\n" % (oldrev, newrev))
f.close()
repo.ui.debug('rebase status stored\n')
@ -512,7 +515,10 @@ def restorestatus(repo):
keepbranches = bool(int(l))
else:
oldrev, newrev = l.split(':')
state[repo[oldrev].rev()] = repo[newrev].rev()
if newrev != str(nullmerge):
state[repo[oldrev].rev()] = repo[newrev].rev()
else:
state[repo[oldrev].rev()] = int(newrev)
skipped = set()
# recompute the set of skipped revs
if not collapse:

View File

@ -303,3 +303,41 @@ Rebasing across null as ancestor
|/
o 0: 'A'
$ cd ..
Ensure --continue restores a correct state (issue3046):
$ hg clone -q a a6
$ cd a6
$ hg up -q 3
$ echo 'H2' > H
$ hg ci -A -m 'H2'
adding H
$ hg rebase -s 8 -d 7 --detach --config ui.merge=internal:fail
merging H
warning: conflicts during merge.
merging H failed!
abort: unresolved conflicts (see hg resolve, then hg rebase --continue)
[255]
$ hg resolve --all -t internal:local
$ hg rebase -c
saved backup bundle to $TESTTMP/a6/.hg/strip-backup/6215fafa5447-backup.hg
$ hg tglog
@ 8: 'H2'
|
o 7: 'H'
|
| o 6: 'G'
|/|
o | 5: 'F'
| |
| o 4: 'E'
|/
| o 3: 'D'
| |
| o 2: 'C'
| |
| o 1: 'B'
|/
o 0: 'A'