# HG changeset patch # User Matt Mackall # Date 1394730308 18000 # Node ID 2764148aa088da248f74d1bf92e5d504f7f4db9a # Parent d20817ac628a22ff5f3adf2551c33203a9b01eb7# Parent b0153cb8b64efb546cbf3bd6bba5a6770ab2563f merge with stable diff -r d20817ac628a -r 2764148aa088 mercurial/cmdutil.py --- a/mercurial/cmdutil.py Tue Feb 04 18:33:25 2014 -0500 +++ b/mercurial/cmdutil.py Thu Mar 13 12:05:08 2014 -0500 @@ -1969,7 +1969,11 @@ ph = repo.ui.config('phases', 'new-commit', phases.draft) try: - repo.ui.setconfig('phases', 'new-commit', old.phase()) + if opts.get('secret'): + commitphase = 'secret' + else: + commitphase = old.phase() + repo.ui.setconfig('phases', 'new-commit', commitphase) newid = repo.commitctx(new) finally: repo.ui.setconfig('phases', 'new-commit', ph) diff -r d20817ac628a -r 2764148aa088 mercurial/commands.py --- a/mercurial/commands.py Tue Feb 04 18:33:25 2014 -0500 +++ b/mercurial/commands.py Thu Mar 13 12:05:08 2014 -0500 @@ -1397,6 +1397,7 @@ if opts.get('force_editor'): e = cmdutil.commitforceeditor + # commitfunc is used only for temporary amend commit by cmdutil.amend def commitfunc(ui, repo, message, match, opts): editor = e # message contains text from -m or -l, if it's empty, @@ -1404,18 +1405,12 @@ if not message: message = old.description() editor = cmdutil.commitforceeditor - try: - if opts.get('secret'): - ui.setconfig('phases', 'new-commit', 'secret') - - return repo.commit(message, - opts.get('user') or old.user(), - opts.get('date') or old.date(), - match, - editor=editor, - extra=extra) - finally: - ui.setconfig('phases', 'new-commit', oldcommitphase) + return repo.commit(message, + opts.get('user') or old.user(), + opts.get('date') or old.date(), + match, + editor=editor, + extra=extra) current = repo._bookmarkcurrent marks = old.bookmarks() diff -r d20817ac628a -r 2764148aa088 mercurial/scmutil.py --- a/mercurial/scmutil.py Tue Feb 04 18:33:25 2014 -0500 +++ b/mercurial/scmutil.py Thu Mar 13 12:05:08 2014 -0500 @@ -506,7 +506,7 @@ start, end = spec.split(_revrangesep, 1) start = revfix(repo, start, 0) end = revfix(repo, end, len(repo) - 1) - if end == nullrev and start <= 0: + if end == nullrev and start < 0: start = nullrev rangeiter = repo.changelog.revs(start, end) if not seen and not l: diff -r d20817ac628a -r 2764148aa088 tests/test-commit-amend.t --- a/tests/test-commit-amend.t Tue Feb 04 18:33:25 2014 -0500 +++ b/tests/test-commit-amend.t Thu Mar 13 12:05:08 2014 -0500 @@ -765,3 +765,14 @@ $ hg ci --close-branch -m'open and close' abort: can only close branch heads [255] + +Test that amend with --secret creates new secret changeset forcibly +--------------------------------------------------------------------- + + $ hg phase '.^::.' + 35: draft + 36: draft + $ hg commit --amend --secret -m 'amend as secret' -q + $ hg phase '.^::.' + 35: draft + 38: secret diff -r d20817ac628a -r 2764148aa088 tests/test-glog.t --- a/tests/test-glog.t Tue Feb 04 18:33:25 2014 -0500 +++ b/tests/test-glog.t Thu Mar 13 12:05:08 2014 -0500 @@ -2111,6 +2111,11 @@ issue3772 $ hg log -G -r :null + o changeset: 0:f8035bb17114 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: add a + | o changeset: -1:000000000000 user: date: Thu Jan 01 00:00:00 1970 +0000 diff -r d20817ac628a -r 2764148aa088 tests/test-log.t --- a/tests/test-log.t Tue Feb 04 18:33:25 2014 -0500 +++ b/tests/test-log.t Thu Mar 13 12:05:08 2014 -0500 @@ -1356,6 +1356,12 @@ issue3772: hg log -r :null showing revision 0 as well $ hg log -r :null + changeset: 0:65624cd9070a + tag: tip + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: a bunch of weird directories + changeset: -1:000000000000 user: date: Thu Jan 01 00:00:00 1970 +0000