Mercurial > hg
changeset 33169:aadd79149ac3 stable
merge with i18n
author | Augie Fackler <augie@google.com> |
---|---|
date | Tue, 04 Jul 2017 10:18:44 -0400 |
parents | 664d6f6c2a48 (diff) 094532cee533 (current diff) |
children | 26c49ed51a69 |
files | |
diffstat | 6 files changed, 195 insertions(+), 62 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/rebase.py Thu Jun 29 12:07:54 2017 -0300 +++ b/hgext/rebase.py Tue Jul 04 10:18:44 2017 -0400 @@ -343,7 +343,7 @@ if dest.closesbranch() and not self.keepbranchesf: self.ui.status(_('reopening closed branch head %s\n') % dest) - def _performrebase(self, tr): + def _performrebase(self): repo, ui, opts = self.repo, self.ui, self.opts if self.keepbranchesf: # insert _savebranch at the start of extrafns so if @@ -393,7 +393,7 @@ self.state, self.targetancestors, self.obsoletenotrebased) - self.storestatus(tr=tr) + self.storestatus() storecollapsemsg(repo, self.collapsemsg) if len(repo[None].parents()) == 2: repo.ui.debug('resuming interrupted rebase\n') @@ -475,24 +475,12 @@ editopt = True editor = cmdutil.getcommiteditor(edit=editopt, editform=editform) revtoreuse = max(self.state) - dsguard = dirstateguard.dirstateguard(repo, 'rebase') - try: - newnode = concludenode(repo, revtoreuse, p1, self.external, - commitmsg=commitmsg, - extrafn=_makeextrafn(self.extrafns), - editor=editor, - keepbranches=self.keepbranchesf, - date=self.date) - dsguard.close() - release(dsguard) - except error.InterventionRequired: - dsguard.close() - release(dsguard) - raise - except Exception: - release(dsguard) - raise - + newnode = concludenode(repo, revtoreuse, p1, self.external, + commitmsg=commitmsg, + extrafn=_makeextrafn(self.extrafns), + editor=editor, + keepbranches=self.keepbranchesf, + date=self.date) if newnode is None: newrev = self.target else: @@ -733,20 +721,7 @@ if retcode is not None: return retcode - with repo.transaction('rebase') as tr: - dsguard = dirstateguard.dirstateguard(repo, 'rebase') - try: - rbsrt._performrebase(tr) - dsguard.close() - release(dsguard) - except error.InterventionRequired: - dsguard.close() - release(dsguard) - tr.close() - raise - except Exception: - release(dsguard) - raise + rbsrt._performrebase() rbsrt._finishrebase() finally: release(lock, wlock) @@ -874,28 +849,33 @@ '''Commit the wd changes with parents p1 and p2. Reuse commit info from rev but also store useful information in extra. Return node of committed revision.''' - repo.setparents(repo[p1].node(), repo[p2].node()) - ctx = repo[rev] - if commitmsg is None: - commitmsg = ctx.description() - keepbranch = keepbranches and repo[p1].branch() != ctx.branch() - extra = {'rebase_source': ctx.hex()} - if extrafn: - extrafn(ctx, extra) + dsguard = dirstateguard.dirstateguard(repo, 'rebase') + try: + repo.setparents(repo[p1].node(), repo[p2].node()) + ctx = repo[rev] + if commitmsg is None: + commitmsg = ctx.description() + keepbranch = keepbranches and repo[p1].branch() != ctx.branch() + extra = {'rebase_source': ctx.hex()} + if extrafn: + extrafn(ctx, extra) - targetphase = max(ctx.phase(), phases.draft) - overrides = {('phases', 'new-commit'): targetphase} - with repo.ui.configoverride(overrides, 'rebase'): - if keepbranch: - repo.ui.setconfig('ui', 'allowemptycommit', True) - # Commit might fail if unresolved files exist - if date is None: - date = ctx.date() - newnode = repo.commit(text=commitmsg, user=ctx.user(), - date=date, extra=extra, editor=editor) + targetphase = max(ctx.phase(), phases.draft) + overrides = {('phases', 'new-commit'): targetphase} + with repo.ui.configoverride(overrides, 'rebase'): + if keepbranch: + repo.ui.setconfig('ui', 'allowemptycommit', True) + # Commit might fail if unresolved files exist + if date is None: + date = ctx.date() + newnode = repo.commit(text=commitmsg, user=ctx.user(), + date=date, extra=extra, editor=editor) - repo.dirstate.setbranch(repo[newnode].branch()) - return newnode + repo.dirstate.setbranch(repo[newnode].branch()) + dsguard.close() + return newnode + finally: + release(dsguard) def rebasenode(repo, rev, p1, base, state, collapse, target): 'Rebase a single revision rev on top of p1 using base as merge ancestor'
--- a/tests/test-rebase-abort.t Thu Jun 29 12:07:54 2017 -0300 +++ b/tests/test-rebase-abort.t Tue Jul 04 10:18:44 2017 -0400 @@ -374,11 +374,10 @@ $ hg --config extensions.n=$TESTDIR/failfilemerge.py rebase -s 3 -d tip rebasing 3:3a71550954f1 "b" rebasing 4:e80b69427d80 "c" - transaction abort! - rollback completed abort: ^C [255] $ hg rebase --abort + saved backup bundle to $TESTTMP/interrupted/.hg/strip-backup/3d8812cf300d-93041a90-backup.hg (glob) rebase aborted $ hg log -G --template "{rev} {desc} {bookmarks}" o 6 no-a @@ -399,7 +398,7 @@ parent: 0:df4f53cec30a base branch: default - commit: 1 unknown (clean) + commit: (clean) update: 6 new changesets (update) phases: 7 draft
--- a/tests/test-rebase-collapse.t Thu Jun 29 12:07:54 2017 -0300 +++ b/tests/test-rebase-collapse.t Tue Jul 04 10:18:44 2017 -0400 @@ -572,8 +572,6 @@ o 0: 'A' $ hg rebase --keepbranches --collapse -s 1 -d 3 - transaction abort! - rollback completed abort: cannot collapse multiple named branches [255]
--- a/tests/test-rebase-conflicts.t Thu Jun 29 12:07:54 2017 -0300 +++ b/tests/test-rebase-conflicts.t Tue Jul 04 10:18:44 2017 -0400 @@ -225,6 +225,7 @@ ignoring null merge rebase of 8 rebasing 9:e31216eec445 "more changes to f1" future parents are 2 and -1 + rebase status stored update to 2:4bc80088dc6b resolving manifests branchmerge: False, force: True, partial: False @@ -250,6 +251,7 @@ rebased as 19c888675e13 rebasing 10:2f2496ddf49d "merge" (tip) future parents are 11 and 7 + rebase status stored already in target merge against 10:2f2496ddf49d detach base 9:e31216eec445 @@ -267,7 +269,6 @@ committing changelog rebased as 2a7f09cac94c rebase merging completed - rebase status stored update back to initial working directory parent resolving manifests branchmerge: False, force: False, partial: False
--- a/tests/test-rebase-interruptions.t Thu Jun 29 12:07:54 2017 -0300 +++ b/tests/test-rebase-interruptions.t Tue Jul 04 10:18:44 2017 -0400 @@ -271,4 +271,161 @@ |/ o 0:public 'A' + +Test rebase interrupted by hooks + + $ hg up 2 + 1 files updated, 0 files merged, 1 files removed, 0 files unresolved + $ echo F > F + $ hg add F + $ hg ci -m F + $ cd .. + +(precommit version) + + $ cp -R a3 hook-precommit + $ cd hook-precommit + $ hg rebase --source 2 --dest 5 --tool internal:other --config 'hooks.precommit=hg status | grep "M A"' + rebasing 2:965c486023db "C" + M A + rebasing 6:a0b2430ebfb8 "F" (tip) + abort: precommit hook exited with status 1 + [255] + $ hg tglogp + @ 7:secret 'C' + | + | @ 6:secret 'F' + | | + o | 5:public 'B' + | | + o | 4:public 'E' + | | + o | 3:public 'D' + | | + | o 2:secret 'C' + | | + | o 1:public 'B' + |/ + o 0:public 'A' + + $ hg rebase --continue + already rebased 2:965c486023db "C" as 401ccec5e39f + rebasing 6:a0b2430ebfb8 "F" + saved backup bundle to $TESTTMP/hook-precommit/.hg/strip-backup/965c486023db-aa6250e7-backup.hg (glob) + $ hg tglogp + @ 6:secret 'F' + | + o 5:secret 'C' + | + o 4:public 'B' + | + o 3:public 'E' + | + o 2:public 'D' + | + | o 1:public 'B' + |/ + o 0:public 'A' + + $ cd .. + +(pretxncommit version) + + $ cp -R a3 hook-pretxncommit + $ cd hook-pretxncommit + $ hg rebase --source 2 --dest 5 --tool internal:other --config 'hooks.pretxncommit=hg log -r $HG_NODE | grep "summary: C"' + rebasing 2:965c486023db "C" + summary: C + rebasing 6:a0b2430ebfb8 "F" (tip) + transaction abort! + rollback completed + abort: pretxncommit hook exited with status 1 + [255] + $ hg tglogp + @ 7:secret 'C' + | + | @ 6:secret 'F' + | | + o | 5:public 'B' + | | + o | 4:public 'E' + | | + o | 3:public 'D' + | | + | o 2:secret 'C' + | | + | o 1:public 'B' + |/ + o 0:public 'A' + + $ hg rebase --continue + already rebased 2:965c486023db "C" as 401ccec5e39f + rebasing 6:a0b2430ebfb8 "F" + saved backup bundle to $TESTTMP/hook-pretxncommit/.hg/strip-backup/965c486023db-aa6250e7-backup.hg (glob) + $ hg tglogp + @ 6:secret 'F' + | + o 5:secret 'C' + | + o 4:public 'B' + | + o 3:public 'E' + | + o 2:public 'D' + | + | o 1:public 'B' + |/ + o 0:public 'A' + + $ cd .. + +(pretxnclose version) + + $ cp -R a3 hook-pretxnclose + $ cd hook-pretxnclose + $ hg rebase --source 2 --dest 5 --tool internal:other --config 'hooks.pretxnclose=hg log -r tip | grep "summary: C"' + rebasing 2:965c486023db "C" + summary: C + rebasing 6:a0b2430ebfb8 "F" (tip) + transaction abort! + rollback completed + abort: pretxnclose hook exited with status 1 + [255] + $ hg tglogp + @ 7:secret 'C' + | + | @ 6:secret 'F' + | | + o | 5:public 'B' + | | + o | 4:public 'E' + | | + o | 3:public 'D' + | | + | o 2:secret 'C' + | | + | o 1:public 'B' + |/ + o 0:public 'A' + + $ hg rebase --continue + already rebased 2:965c486023db "C" as 401ccec5e39f + rebasing 6:a0b2430ebfb8 "F" + saved backup bundle to $TESTTMP/hook-pretxnclose/.hg/strip-backup/965c486023db-aa6250e7-backup.hg (glob) + $ hg tglogp + @ 6:secret 'F' + | + o 5:secret 'C' + | + o 4:public 'B' + | + o 3:public 'E' + | + o 2:public 'D' + | + | o 1:public 'B' + |/ + o 0:public 'A' + + $ cd ..
--- a/tests/test-rebase-scenario-global.t Thu Jun 29 12:07:54 2017 -0300 +++ b/tests/test-rebase-scenario-global.t Tue Jul 04 10:18:44 2017 -0400 @@ -270,8 +270,6 @@ $ hg rebase -s 6 -d 1 rebasing 6:eea13746799a "G" - transaction abort! - rollback completed abort: cannot use revision 6 as base, result would have 3 parents [255] $ hg rebase --abort