diff --git a/hgext/rebase.py b/hgext/rebase.py --- a/hgext/rebase.py +++ b/hgext/rebase.py @@ -325,7 +325,7 @@ skippedset.update(obsoleteextinctsuccessors) _checkobsrebase(self.repo, self.ui, obsoleteset, skippedset) - def _prepareabortorcontinue(self, isabort): + def _prepareabortorcontinue(self, isabort, **opts): try: self.restorestatus() self.collapsemsg = restorecollapsemsg(self.repo, isabort) @@ -341,8 +341,10 @@ hint = _('use "hg rebase --abort" to clear broken state') raise error.Abort(msg, hint=hint) if isabort: - return abort(self.repo, self.originalwd, self.destmap, - self.state, activebookmark=self.activebookmark) + suppwarning = opts.get(r'dry_run') + return abort(self.repo, self.originalwd, self.destmap, self.state, + activebookmark=self.activebookmark, + suppwarning=suppwarning) def _preparenewrebase(self, destmap): if not destmap: @@ -818,6 +820,7 @@ opts[r'dest'] = '_destautoorphanrebase(SRC)' if dryrun: + ui.status(_('starting dry-run rebase; repository will not be changed\n')) try: overrides = {('rebase', 'singletransaction'): True} with ui.configoverride(overrides, 'rebase'): @@ -826,9 +829,11 @@ except error.InMemoryMergeConflictsError: ui.status(_('hit a merge conflict\n')) else: - ui.status(_('there will be no conflict, you can rebase\n')) + ui.status(_('dry-run rebase completed successfully; run without ' + '-n/--dry-run to perform this rebase\n')) finally: - _origrebase(ui, repo, abort=True) + opts = {'abort':True, 'dry_run':True} + _origrebase(ui, repo, **opts) elif inmemory: try: # in-memory merge doesn't support conflicts, so if we hit any, abort @@ -889,7 +894,7 @@ ms = mergemod.mergestate.read(repo) mergeutil.checkunresolved(ms) - retcode = rbsrt._prepareabortorcontinue(abortf) + retcode = rbsrt._prepareabortorcontinue(abortf, **opts) if retcode is not None: return retcode else: @@ -1543,7 +1548,8 @@ return False -def abort(repo, originalwd, destmap, state, activebookmark=None): +def abort(repo, originalwd, destmap, state, activebookmark=None, + suppwarning=None): '''Restore the repository to its original state. Additional args: activebookmark: the name of the bookmark that should be active after the @@ -1596,7 +1602,8 @@ finally: clearstatus(repo) clearcollapsemsg(repo) - repo.ui.warn(_('rebase aborted\n')) + if not suppwarning: + repo.ui.warn(_('rebase aborted\n')) return 0 def sortsource(destmap): diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t --- a/tests/test-rebase-inmemory.t +++ b/tests/test-rebase-inmemory.t @@ -208,12 +208,12 @@ Check dryrun gives correct results when there is no conflict in rebasing $ hg rebase -s 2 -d 6 -n + starting dry-run rebase; repository will not be changed rebasing 2:177f92b77385 "c" rebasing 3:055a42cdd887 "d" rebasing 4:e860deea161a "e" - there will be no conflict, you can rebase + dry-run rebase completed successfully; run without -n/--dry-run to perform this rebase saved backup bundle to $TESTTMP/repo1/repo2/skrepo/.hg/strip-backup/c83b1da5b1ae-f1e0beb9-backup.hg - rebase aborted $ hg diff $ hg status @@ -242,11 +242,11 @@ Check dryrun working with --collapse when there is no conflict $ hg rebase -s 2 -d 6 -n --collapse + starting dry-run rebase; repository will not be changed rebasing 2:177f92b77385 "c" rebasing 3:055a42cdd887 "d" rebasing 4:e860deea161a "e" - there will be no conflict, you can rebase - rebase aborted + dry-run rebase completed successfully; run without -n/--dry-run to perform this rebase Check dryrun gives correct results when there is conflict in rebasing Make a conflict: @@ -279,6 +279,7 @@ a $ hg rebase -s 2 -d 7 -n + starting dry-run rebase; repository will not be changed rebasing 2:177f92b77385 "c" rebasing 3:055a42cdd887 "d" rebasing 4:e860deea161a "e" @@ -286,7 +287,6 @@ transaction abort! rollback completed hit a merge conflict - rebase aborted $ hg diff $ hg status $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n" @@ -316,9 +316,9 @@ Check dryrun working with --collapse when there is conflicts $ hg rebase -s 2 -d 7 -n --collapse + starting dry-run rebase; repository will not be changed rebasing 2:177f92b77385 "c" rebasing 3:055a42cdd887 "d" rebasing 4:e860deea161a "e" merging e hit a merge conflict - rebase aborted