changeset 16253:17f179805297

merge with stable
author Matt Mackall <mpm@selenic.com>
date Mon, 12 Mar 2012 17:05:42 -0500
parents db68ee3289b6 (current diff) cf17e76be4dd (diff)
children c655e4acaa82
files hgext/mq.py mercurial/localrepo.py mercurial/repair.py
diffstat 8 files changed, 34 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/win32/mercurial.ini	Wed Mar 07 01:02:12 2012 +0100
+++ b/contrib/win32/mercurial.ini	Mon Mar 12 17:05:42 2012 -0500
@@ -71,7 +71,7 @@
 ;cmd.bc3diff = C:\Program Files\Beyond Compare 3\BCompare.exe
 ;cmd.vdiff = C:\Progra~1\TortoiseSVN\bin\TortoiseMerge.exe
 ;cmd.vimdiff = gvim.exe
-;opts.vimdiff = -f '+next' '+execute "DirDiff ".argv(0)." ".argv(1)'
+;opts.vimdiff = -f "+next" "+execute 'DirDiff' fnameescape(argv(0)) fnameescape(argv(1))"
 
 
 [hgk]
--- a/hgext/extdiff.py	Wed Mar 07 01:02:12 2012 +0100
+++ b/hgext/extdiff.py	Mon Mar 12 17:05:42 2012 -0500
@@ -33,7 +33,8 @@
   # (see http://www.vim.org/scripts/script.php?script_id=102) Non
   # English user, be sure to put "let g:DirDiffDynamicDiffText = 1" in
   # your .vimrc
-  vimdiff = gvim -f '+next' '+execute "DirDiff" argv(0) argv(1)'
+  vimdiff = gvim -f "+next" \\
+            "+execute 'DirDiff' fnameescape(argv(0)) fnameescape(argv(1))"
 
 Tool arguments can include variables that are expanded at runtime::
 
--- a/hgext/mq.py	Wed Mar 07 01:02:12 2012 +0100
+++ b/hgext/mq.py	Mon Mar 12 17:05:42 2012 -0500
@@ -1043,8 +1043,7 @@
                 hg.clean(repo, urev)
                 repo.dirstate.write()
 
-            for rev in revs:
-                repair.strip(self.ui, repo, rev, backup)
+            repair.strip(self.ui, repo, revs, backup)
         finally:
             release(lock, wlock)
 
--- a/mercurial/help/phases.txt	Wed Mar 07 01:02:12 2012 +0100
+++ b/mercurial/help/phases.txt	Mon Mar 12 17:05:42 2012 -0500
@@ -14,7 +14,7 @@
 These phases are ordered (public < draft < secret) and no changeset
 can be in a lower phase than its ancestors. For instance, if a
 changeset is public, all its ancestors are also public. Lastly,
-changeset phases only be changed towards the public phase.
+changeset phases should only be changed towards the public phase.
 
 How are phases managed?
 -----------------------
--- a/mercurial/localrepo.py	Wed Mar 07 01:02:12 2012 +0100
+++ b/mercurial/localrepo.py	Mon Mar 12 17:05:42 2012 -0500
@@ -781,11 +781,12 @@
         self.opener.write("journal.desc",
                           "%d\n%s\n" % (len(self), desc))
 
-        bkname = self.join('bookmarks')
-        if os.path.exists(bkname):
-            util.copyfile(bkname, self.join('journal.bookmarks'))
-        else:
-            self.opener.write('journal.bookmarks', '')
+        try:
+            bk = self.opener.read("bookmarks")
+        except IOError:
+            bk = ""
+        self.opener.write("journal.bookmarks", bk)
+
         phasesname = self.sjoin('phaseroots')
         if os.path.exists(phasesname):
             util.copyfile(phasesname, self.sjoin('journal.phaseroots'))
--- a/mercurial/repair.py	Wed Mar 07 01:02:12 2012 +0100
+++ b/mercurial/repair.py	Mon Mar 12 17:05:42 2012 -0500
@@ -54,10 +54,13 @@
 
     return s
 
-def strip(ui, repo, node, backup="all"):
+def strip(ui, repo, nodelist, backup="all"):
     cl = repo.changelog
     # TODO handle undo of merge sets
-    striprev = cl.rev(node)
+    if isinstance(nodelist, str):
+        nodelist = [nodelist]
+    striplist = [cl.rev(node) for node in nodelist]
+    striprev = min(striplist)
 
     keeppartialbundle = backup == 'strip'
 
@@ -68,8 +71,10 @@
     # the list of heads and bases of the set of interesting revisions.
     # (head = revision in the set that has no descendant in the set;
     #  base = revision in the set that has no ancestor in the set)
-    tostrip = set(cl.descendants(striprev))
-    tostrip.add(striprev)
+    tostrip = set(striplist)
+    for rev in striplist:
+        for desc in cl.descendants(rev):
+            tostrip.add(desc)
 
     files = _collectfiles(repo, striprev)
     saverevs = _collectbrokencsets(repo, files, striprev)
@@ -88,6 +93,7 @@
         descendants = set(cl.descendants(*saverevs))
         saverevs.difference_update(descendants)
     savebases = [cl.node(r) for r in saverevs]
+    stripbases = [cl.node(r) for r in tostrip]
 
     bm = repo._bookmarks
     updatebm = []
@@ -99,7 +105,7 @@
     # create a changegroup for all the branches we need to keep
     backupfile = None
     if backup == "all":
-        backupfile = _bundle(repo, [node], cl.heads(), node, 'backup')
+        backupfile = _bundle(repo, stripbases, cl.heads(), node, 'backup')
         repo.ui.status(_("saved backup bundle to %s\n") % backupfile)
     if saveheads or savebases:
         # do not compress partial bundle if we remove it from disk later
--- a/tests/test-extension.t	Wed Mar 07 01:02:12 2012 +0100
+++ b/tests/test-extension.t	Mon Mar 12 17:05:42 2012 -0500
@@ -301,7 +301,8 @@
     # (see http://www.vim.org/scripts/script.php?script_id=102) Non
     # English user, be sure to put "let g:DirDiffDynamicDiffText = 1" in
     # your .vimrc
-    vimdiff = gvim -f '+next' '+execute "DirDiff" argv(0) argv(1)'
+    vimdiff = gvim -f "+next" \
+              "+execute 'DirDiff' fnameescape(argv(0)) fnameescape(argv(1))"
   
   Tool arguments can include variables that are expanded at runtime:
   
--- a/tests/test-mq-strip.t	Wed Mar 07 01:02:12 2012 +0100
+++ b/tests/test-mq-strip.t	Mon Mar 12 17:05:42 2012 -0500
@@ -311,7 +311,6 @@
   $ hg strip 2 4
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
-  saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
   $ hg glog
   @  changeset:   2:65bd5f99a4a3
   |  tag:         tip
@@ -421,3 +420,13 @@
   $ hg status
   M bar
   ? b
+  $ cd ..
+
+stripping many nodes on a complex graph (issue3299)
+
+  $ hg init issue3299
+  $ cd issue3299
+  $ hg debugbuilddag '@a.:a@b.:b.:x<a@a.:a<b@b.:b<a@a.:a'
+  $ hg strip 'not ancestors(x)'
+  saved backup bundle to $TESTTMP/issue3299/.hg/strip-backup/*-backup.hg (glob)
+