changeset 19306:59cdd3a7e281

merge with stable
author Matt Mackall <mpm@selenic.com>
date Fri, 07 Jun 2013 16:59:59 -0500
parents 59d5281b5799 (current diff) b500a663a2c7 (diff)
children 5443d40d524b
files hgext/histedit.py mercurial/commands.py
diffstat 6 files changed, 51 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/histedit.py	Fri Jun 07 16:04:11 2013 -0500
+++ b/hgext/histedit.py	Fri Jun 07 16:59:59 2013 -0500
@@ -140,6 +140,7 @@
 
 try:
     import cPickle as pickle
+    pickle.dump # import now
 except ImportError:
     import pickle
 import os
--- a/mercurial/commands.py	Fri Jun 07 16:04:11 2013 -0500
+++ b/mercurial/commands.py	Fri Jun 07 16:59:59 2013 -0500
@@ -1334,12 +1334,19 @@
         raise util.Abort(_('cannot commit an interrupted graft operation'),
                          hint=_('use "hg graft -c" to continue graft'))
 
+    branch = repo[None].branch()
+    bheads = repo.branchheads(branch)
+
     extra = {}
     if opts.get('close_branch'):
         extra['close'] = 1
 
-    branch = repo[None].branch()
-    bheads = repo.branchheads(branch)
+        if not bheads:
+            raise util.Abort(_('can only close branch heads'))
+        elif opts.get('amend'):
+            if repo.parents()[0].p1().branch() != branch and \
+                    repo.parents()[0].p2().branch() != branch:
+                raise util.Abort(_('can only close branch heads'))
 
     if opts.get('amend'):
         if ui.configbool('ui', 'commitsubrepos'):
--- a/mercurial/help/extensions.txt	Fri Jun 07 16:04:11 2013 -0500
+++ b/mercurial/help/extensions.txt	Fri Jun 07 16:59:59 2013 -0500
@@ -3,14 +3,6 @@
 existing commands, change the default behavior of commands, or
 implement hooks.
 
-Extensions are not loaded by default for a variety of reasons:
-they can increase startup overhead; they may be meant for advanced
-usage only; they may provide potentially dangerous abilities (such
-as letting you destroy or modify history); they might not be ready
-for prime time; or they may alter some usual behaviors of stock
-Mercurial. It is thus up to the user to activate extensions as
-needed.
-
 To enable the "foo" extension, either shipped with Mercurial or in the
 Python search path, create an entry for it in your configuration file,
 like this::
@@ -23,6 +15,16 @@
   [extensions]
   myfeature = ~/.hgext/myfeature.py
 
+See :hg:`help config` for more information on configuration files.
+
+Extensions are not loaded by default for a variety of reasons:
+they can increase startup overhead; they may be meant for advanced
+usage only; they may provide potentially dangerous abilities (such
+as letting you destroy or modify history); they might not be ready
+for prime time; or they may alter some usual behaviors of stock
+Mercurial. It is thus up to the user to activate extensions as
+needed.
+
 To explicitly disable an extension enabled in a configuration file of
 broader scope, prepend its path with !::
 
--- a/mercurial/help/phases.txt	Fri Jun 07 16:04:11 2013 -0500
+++ b/mercurial/help/phases.txt	Fri Jun 07 16:59:59 2013 -0500
@@ -52,7 +52,7 @@
   [phases]
   publish = False
 
-See :hg:`help config` for more information on config files.
+See :hg:`help config` for more information on configuration files.
 
 .. note::
   Servers running older versions of Mercurial are treated as
--- a/tests/test-branches.t	Fri Jun 07 16:04:11 2013 -0500
+++ b/tests/test-branches.t	Fri Jun 07 16:59:59 2013 -0500
@@ -267,14 +267,16 @@
   $ hg up -C b
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg commit -d '9 0' --close-branch -m 'close this part branch too'
+  $ hg commit -d '9 0' --close-branch -m 're-closing this branch'
+  abort: can only close branch heads
+  [255]
 
-  $ hg commit -d '9 0' --close-branch -m 're-closing this branch'
   $ hg log -r tip --debug
-  changeset:   13:c2601d54b1427e99506bee25a566ef3a5963af0b
+  changeset:   12:e3d49c0575d8fc2cb1cd6859c747c14f5f6d499f
   branch:      b
   tag:         tip
   phase:       draft
-  parent:      12:e3d49c0575d8fc2cb1cd6859c747c14f5f6d499f
+  parent:      8:eebb944467c9fb9651ed232aeaf31b3c0a7fc6c1
   parent:      -1:0000000000000000000000000000000000000000
   manifest:    8:6f9ed32d2b310e391a4f107d5f0f071df785bfee
   user:        test
@@ -282,13 +284,9 @@
   extra:       branch=b
   extra:       close=1
   description:
-  re-closing this branch
+  close this part branch too
   
   
-  $ hg rollback
-  repository tip rolled back to revision 12 (undo commit)
-  working directory now based on revision 12
-
 --- b branch should be inactive
 
   $ hg branches
--- a/tests/test-commit-amend.t	Fri Jun 07 16:04:11 2013 -0500
+++ b/tests/test-commit-amend.t	Fri Jun 07 16:59:59 2013 -0500
@@ -743,3 +743,27 @@
   -aa
   -aa
   
+Issue 3445: amending with --close-branch a commit that created a new head should fail
+This shouldn't be possible:
+
+  $ hg up -q default
+  $ hg branch closewithamend
+  marked working directory as branch closewithamend
+  (branches are permanent and global, did you want a bookmark?)
+  $ hg ci -Am..
+  adding cc.orig
+  adding obs.py
+  adding obs.pyc
+  $ hg ci --amend --close-branch -m 'closing'
+  abort: can only close branch heads
+  [255]
+
+This silliness fails:
+
+  $ hg branch silliness
+  marked working directory as branch silliness
+  (branches are permanent and global, did you want a bookmark?)
+  $ echo b >> b
+  $ hg ci --close-branch -m'open and close'
+  abort: can only close branch heads
+  [255]