# HG changeset patch # User Matt Mackall # Date 1402340003 18000 # Node ID db2392a4effc4d1f3e6cf96970004788768ae292 # Parent 28ecdf3fa1dbb874c0b6cb7bdc1ab73fd3a9b3f9# Parent 14560418856dbd2b1b5d0bf1b4ae3bceffc4eef0 merge with stable diff -r 28ecdf3fa1db -r db2392a4effc hgext/keyword.py --- a/hgext/keyword.py Fri Jun 06 00:21:46 2014 -0500 +++ b/hgext/keyword.py Mon Jun 09 13:53:23 2014 -0500 @@ -102,7 +102,8 @@ # hg commands that trigger expansion only when writing to working dir, # not when reading filelog, and unexpand when reading from working dir -restricted = 'merge kwexpand kwshrink record qrecord resolve transplant' +restricted = ('merge kwexpand kwshrink record qrecord resolve transplant' + ' unshelve rebase graft backout histedit fetch') # names of extensions using dorecord recordextensions = 'record' diff -r 28ecdf3fa1db -r db2392a4effc mercurial/commands.py --- a/mercurial/commands.py Fri Jun 06 00:21:46 2014 -0500 +++ b/mercurial/commands.py Mon Jun 09 13:53:23 2014 -0500 @@ -4943,56 +4943,62 @@ raise util.Abort(_('no files or directories specified; ' 'use --all to remerge all files')) - ms = mergemod.mergestate(repo) - - if not ms.active() and not show: - raise util.Abort(_('resolve command not applicable when not merging')) - - m = scmutil.match(repo[None], pats, opts) - ret = 0 - - didwork = False - for f in ms: - if not m(f): - continue - - didwork = True - - if show: - if nostatus: - ui.write("%s\n" % f) + wlock = repo.wlock() + try: + ms = mergemod.mergestate(repo) + + if not ms.active() and not show: + raise util.Abort( + _('resolve command not applicable when not merging')) + + m = scmutil.match(repo[None], pats, opts) + ret = 0 + didwork = False + + for f in ms: + if not m(f): + continue + + didwork = True + + if show: + if nostatus: + ui.write("%s\n" % f) + else: + ui.write("%s %s\n" % (ms[f].upper(), f), + label='resolve.' + + {'u': 'unresolved', 'r': 'resolved'}[ms[f]]) + elif mark: + ms.mark(f, "r") + elif unmark: + ms.mark(f, "u") else: - ui.write("%s %s\n" % (ms[f].upper(), f), - label='resolve.' + - {'u': 'unresolved', 'r': 'resolved'}[ms[f]]) - elif mark: - ms.mark(f, "r") - elif unmark: - ms.mark(f, "u") - else: - wctx = repo[None] - - # backup pre-resolve (merge uses .orig for its own purposes) - a = repo.wjoin(f) - util.copyfile(a, a + ".resolve") - - try: - # resolve file - ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), - 'resolve') - if ms.resolve(f, wctx): - ret = 1 - finally: - ui.setconfig('ui', 'forcemerge', '', 'resolve') - ms.commit() - - # replace filemerge's .orig file with our resolve file - util.rename(a + ".resolve", a + ".orig") - - ms.commit() - - if not didwork and pats: - ui.warn(_("arguments do not match paths that need resolved\n")) + wctx = repo[None] + + # backup pre-resolve (merge uses .orig for its own purposes) + a = repo.wjoin(f) + util.copyfile(a, a + ".resolve") + + try: + # resolve file + ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), + 'resolve') + if ms.resolve(f, wctx): + ret = 1 + finally: + ui.setconfig('ui', 'forcemerge', '', 'resolve') + ms.commit() + + # replace filemerge's .orig file with our resolve file + util.rename(a + ".resolve", a + ".orig") + + ms.commit() + + if not didwork and pats: + ui.warn(_("arguments do not match paths that need resolved\n")) + + finally: + wlock.release() # Nudge users into finishing an unfinished operation. We don't print # this with the list/show operation because we want list/show to remain diff -r 28ecdf3fa1db -r db2392a4effc tests/test-keyword.t --- a/tests/test-keyword.t Fri Jun 06 00:21:46 2014 -0500 +++ b/tests/test-keyword.t Mon Jun 09 13:53:23 2014 -0500 @@ -1138,6 +1138,7 @@ Now disable keyword expansion + $ cp $HGRCPATH $HGRCPATH.backup $ rm "$HGRCPATH" $ cat a b expand $Id$ @@ -1153,4 +1154,158 @@ ignore $Id$ a +enable keyword expansion again + + $ cat $HGRCPATH.backup >> $HGRCPATH + +Test restricted mode with unshelve + + $ cat <> $HGRCPATH + > [extensions] + > shelve = + > EOF + + $ echo xxxx >> a + $ hg diff + diff -r 800511b3a22d a + --- a/a Thu Jan 01 00:00:00 1970 +0000 + +++ b/a * (glob) + @@ -2,3 +2,4 @@ + do not process $Id: + xxx $ + $Xinfo$ + +xxxx + $ hg shelve -q --name tmp + $ hg shelve --list --patch + tmp (*) changes to 'localresolve' (glob) + + diff --git a/a b/a + --- a/a + +++ b/a + @@ -2,3 +2,4 @@ + do not process $Id: + xxx $ + $Xinfo$ + +xxxx + + $ hg update -q -C 10 + $ hg unshelve -q tmp + $ hg diff + diff -r 4aa30d025d50 a + --- a/a Thu Jan 01 00:00:00 1970 +0000 + +++ b/a * (glob) + @@ -3,3 +3,4 @@ + do not process $Id: + xxx $ + $Xinfo$ + +xxxx + +Test restricted mode with rebase + + $ cat <> $HGRCPATH + > [extensions] + > rebase = + > EOF + + $ hg update -q -C 9 + + $ echo xxxx >> a + $ hg commit -m '#11' + $ hg diff -c 11 + diff -r 800511b3a22d -r b07670694489 a + --- a/a Thu Jan 01 00:00:00 1970 +0000 + +++ b/a Thu Jan 01 00:00:00 1970 +0000 + @@ -2,3 +2,4 @@ + do not process $Id: + xxx $ + $Xinfo$ + +xxxx + + $ hg diff -c 10 + diff -r 27d48ee14f67 -r 4aa30d025d50 a + --- a/a Thu Jan 01 00:00:00 1970 +0000 + +++ b/a Thu Jan 01 00:00:00 1970 +0000 + @@ -1,3 +1,4 @@ + +foobranch + expand $Id$ + do not process $Id: + xxx $ + + $ hg rebase -q -s 10 -d 11 --keep + $ hg diff -r 9 -r 12 a + diff -r 800511b3a22d -r 1939b927726c a + --- a/a Thu Jan 01 00:00:00 1970 +0000 + +++ b/a Thu Jan 01 00:00:00 1970 +0000 + @@ -1,4 +1,6 @@ + +foobranch + expand $Id$ + do not process $Id: + xxx $ + $Xinfo$ + +xxxx + +Test restricted mode with graft + + $ hg graft -q 10 + $ hg diff -r 9 -r 13 a + diff -r 800511b3a22d -r 01a68de1003a a + --- a/a Thu Jan 01 00:00:00 1970 +0000 + +++ b/a Thu Jan 01 00:00:00 1970 +0000 + @@ -1,4 +1,6 @@ + +foobranch + expand $Id$ + do not process $Id: + xxx $ + $Xinfo$ + +xxxx + +Test restricted mode with backout + + $ hg backout -q 11 + $ hg diff a + diff -r 01a68de1003a a + --- a/a Thu Jan 01 00:00:00 1970 +0000 + +++ b/a * (glob) + @@ -3,4 +3,3 @@ + do not process $Id: + xxx $ + $Xinfo$ + -xxxx + +Test restricted mode with histedit + + $ cat <> $HGRCPATH + > [extensions] + > histedit = + > EOF + + $ hg commit -m 'backout #11' + $ hg histedit -q --command - 13 < pick 49f5f2d940c3 14 backout #11 + > pick 01a68de1003a 13 9foobranch + > EOF + +Test restricted mode with fetch (with merge) + + $ cat <> $HGRCPATH + > [extensions] + > fetch = + > EOF + + $ hg clone -q -r 9 . ../fetch-merge + $ cd ../fetch-merge + $ hg -R ../Test export 10 | hg import -q - + $ hg fetch -q -r 11 + $ hg diff -r 9 a + diff -r 800511b3a22d a + --- a/a Thu Jan 01 00:00:00 1970 +0000 + +++ b/a * (glob) + @@ -1,4 +1,6 @@ + +foobranch + expand $Id$ + do not process $Id: + xxx $ + $Xinfo$ + +xxxx + $ cd ..