changeset 17468:8fea378242e3

Merge with stable
author Patrick Mezard <patrick@mezard.eu>
date Sun, 09 Sep 2012 12:35:06 +0200
parents 448d0c452140 (current diff) 8085fed2bf0a (diff)
children 89467a7c2132
files mercurial/cmdutil.py tests/test-largefiles.t
diffstat 3 files changed, 25 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Sun Sep 09 12:31:14 2012 +0200
+++ b/mercurial/cmdutil.py	Sun Sep 09 12:35:06 2012 +0200
@@ -10,7 +10,7 @@
 import os, sys, errno, re, tempfile
 import util, scmutil, templater, patch, error, templatekw, revlog, copies
 import match as matchmod
-import subrepo, context, repair, bookmarks, graphmod, revset
+import subrepo, context, repair, bookmarks, graphmod, revset, phases
 
 def parsealiases(cmd):
     return cmd.lstrip("^").split("|")
@@ -1675,7 +1675,12 @@
                              user=user,
                              date=date,
                              extra=extra)
-        newid = repo.commitctx(new)
+        ph = repo.ui.config('phases', 'new-commit', phases.draft)
+        try:
+            repo.ui.setconfig('phases', 'new-commit', old.phase())
+            newid = repo.commitctx(new)
+        finally:
+            repo.ui.setconfig('phases', 'new-commit', ph)
         if newid != old.node():
             # Reroute the working copy parent to the new changeset
             repo.setparents(newid, nullid)
--- a/tests/test-commit-amend.t	Sun Sep 09 12:31:14 2012 +0200
+++ b/tests/test-commit-amend.t	Sun Sep 09 12:35:06 2012 +0200
@@ -25,7 +25,7 @@
 
   $ cat >> $HGRCPATH <<EOF
   > [hooks]
-  > pretxncommit.foo = sh -c "echo \"pretxncommit \$HG_NODE\"; hg id -r \$HG_NODE"
+  > pretxncommit.foo = sh -c "echo \\"pretxncommit \$HG_NODE\\"; hg id -r \$HG_NODE"
   > EOF
 
 Amending changeset with changes in working dir:
@@ -355,3 +355,18 @@
   $ hg log -r . --debug | grep extra
   extra:       branch=a
   extra:       source=2647734878ef0236dda712fae9c1651cf694ea8a
+
+Preserve phase
+
+  $ hg phase '.^::.'
+  11: draft
+  13: draft
+  $ hg phase --secret --force .
+  $ hg phase '.^::.'
+  11: draft
+  13: secret
+  $ hg commit --amend -m 'amend for phase' -q
+  $ hg phase '.^::.'
+  11: draft
+  13: secret
+
--- a/tests/test-largefiles.t	Sun Sep 09 12:31:14 2012 +0200
+++ b/tests/test-largefiles.t	Sun Sep 09 12:35:06 2012 +0200
@@ -13,7 +13,7 @@
   > patterns=glob:**.dat
   > usercache=${USERCACHE}
   > [hooks]
-  > precommit=sh -c "echo \"Invoking status precommit hook\"; hg status"
+  > precommit=sh -c "echo \\"Invoking status precommit hook\\"; hg status"
   > EOF
 
 Create the repo with a couple of revisions of both large and normal
@@ -434,7 +434,7 @@
   $ cd ../addrm
   $ cat >> .hg/hgrc <<EOF
   > [hooks]
-  > post-commit.stat=sh -c "echo \"Invoking status postcommit hook\"; hg status -A"
+  > post-commit.stat=sh -c "echo \\"Invoking status postcommit hook\\"; hg status -A"
   > EOF
   $ touch foo
   $ hg add --large foo