merge with stable
authorMatt Mackall <mpm@selenic.com>
Sun, 07 Feb 2016 00:49:31 -0600
changeset 28015 a036e1ae1fbe
parent 28014 83fc0c055664 (current diff)
parent 27988 61f4d59e9a0b (diff)
child 28016 a2be6f0f58fb
merge with stable
hgext/rebase.py
mercurial/revset.py
tests/test-rebase-abort.t
tests/test-revset.t
--- a/hgext/rebase.py	Tue Jan 19 18:20:13 2016 +0000
+++ b/hgext/rebase.py	Sun Feb 07 00:49:31 2016 -0600
@@ -980,15 +980,20 @@
             cleanup = False
 
         if cleanup:
+            shouldupdate = False
+            rebased = filter(lambda x: x >= 0 and x != target, state.values())
+            if rebased:
+                strippoints = [
+                        c.node() for c in repo.set('roots(%ld)', rebased)]
+                shouldupdate = len([
+                        c.node() for c in repo.set('. & (%ld)', rebased)]) > 0
+
             # Update away from the rebase if necessary
-            if needupdate(repo, state):
+            if shouldupdate or needupdate(repo, state):
                 merge.update(repo, originalwd, False, True)
 
             # Strip from the first rebased revision
-            rebased = filter(lambda x: x >= 0 and x != target, state.values())
             if rebased:
-                strippoints = [
-                        c.node()  for c in repo.set('roots(%ld)', rebased)]
                 # no backup of rebased cset versions needed
                 repair.strip(repo.ui, repo, strippoints)
 
--- a/mercurial/help/config.txt	Tue Jan 19 18:20:13 2016 +0000
+++ b/mercurial/help/config.txt	Sun Feb 07 00:49:31 2016 -0600
@@ -2022,7 +2022,7 @@
 ``backgroundclose``
     Whether to enable closing file handles on background threads during certain
     operations. Some platforms aren't very efficient at closing file
-    handles that have been written or appened to. By performing file closing
+    handles that have been written or appended to. By performing file closing
     on background threads, file write rate can increase substantially.
     (default: true on Windows, false elsewhere)
 
--- a/mercurial/revset.py	Tue Jan 19 18:20:13 2016 +0000
+++ b/mercurial/revset.py	Sun Feb 07 00:49:31 2016 -0600
@@ -319,7 +319,7 @@
     if not x:
         return []
     if x[0] == 'list':
-        return getlist(x[1]) + [x[2]]
+        return list(x[1:])
     return [x]
 
 def getargs(x, min, max, err):
@@ -448,7 +448,7 @@
 def notset(repo, subset, x):
     return subset - getset(repo, subset, x)
 
-def listset(repo, subset, a, b):
+def listset(repo, subset, *xs):
     raise error.ParseError(_("can't use a list in this context"),
                            hint=_('see hg help "revsets.x or y"'))
 
@@ -2253,7 +2253,7 @@
         return o[0], (op, o[1])
     elif op == 'group':
         return optimize(x[1], small)
-    elif op in 'dagrange range list parent ancestorspec':
+    elif op in 'dagrange range parent ancestorspec':
         if op == 'parent':
             # x^:y means (x^) : y, not x ^ (:y)
             post = ('parentpost', x[1])
@@ -2265,6 +2265,9 @@
         wa, ta = optimize(x[1], small)
         wb, tb = optimize(x[2], small)
         return wa + wb, (op, ta, tb)
+    elif op == 'list':
+        ws, ts = zip(*(optimize(y, small) for y in x[1:]))
+        return sum(ws), (op,) + ts
     elif op == 'func':
         f = getstring(x[1], _("not a symbol"))
         wa, ta = optimize(x[2], small)
@@ -2366,6 +2369,7 @@
         tree, pos = p.parse(_tokenizealias(decl))
         if (pos != len(decl)):
             raise error.ParseError(_('invalid token'), pos)
+        tree = parser.simplifyinfixops(tree, ('list',))
 
         if isvalidsymbol(tree):
             # "name = ...." style
@@ -2456,7 +2460,7 @@
     tree, pos = p.parse(tokenizedefn(defn))
     if pos != len(defn):
         raise error.ParseError(_('invalid token'), pos)
-    return parser.simplifyinfixops(tree, ('or',))
+    return parser.simplifyinfixops(tree, ('list', 'or'))
 
 class revsetalias(object):
     # whether own `error` information is already shown or not.
@@ -2587,7 +2591,7 @@
     tree, pos = p.parse(tokenize(spec, lookup=lookup))
     if pos != len(spec):
         raise error.ParseError(_("invalid token"), pos)
-    return parser.simplifyinfixops(tree, ('or',))
+    return parser.simplifyinfixops(tree, ('list', 'or'))
 
 def posttreebuilthook(tree, repo):
     # hook for extensions to execute code on the optimized tree
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/failfilemerge.py	Sun Feb 07 00:49:31 2016 -0600
@@ -0,0 +1,18 @@
+# extension to emulate interupting filemerge._filemerge
+
+from __future__ import absolute_import
+
+from mercurial import (
+    filemerge,
+    extensions,
+    error,
+)
+
+def failfilemerge(filemergefn,
+        premerge, repo, mynode, orig, fcd, fco, fca, labels=None):
+    raise error.Abort("^C")
+    return filemergefn(premerge, repo, mynode, orig, fcd, fco, fca, labels)
+
+def extsetup(ui):
+    extensions.wrapfunction(filemerge, '_filemerge',
+                            failfilemerge)
--- a/tests/test-glog.t	Tue Jan 19 18:20:13 2016 +0000
+++ b/tests/test-glog.t	Sun Feb 07 00:49:31 2016 -0600
@@ -1602,11 +1602,9 @@
     (func
       ('symbol', '_matchfiles')
       (list
-        (list
-          (list
-            ('string', 'r:')
-            ('string', 'd:relpath'))
-          ('string', 'p:a'))
+        ('string', 'r:')
+        ('string', 'd:relpath')
+        ('string', 'p:a')
         ('string', 'p:c'))))
 
 Test multiple --include/--exclude/paths
@@ -1617,19 +1615,13 @@
     (func
       ('symbol', '_matchfiles')
       (list
-        (list
-          (list
-            (list
-              (list
-                (list
-                  (list
-                    ('string', 'r:')
-                    ('string', 'd:relpath'))
-                  ('string', 'p:a'))
-                ('string', 'p:e'))
-              ('string', 'i:a'))
-            ('string', 'i:e'))
-          ('string', 'x:b'))
+        ('string', 'r:')
+        ('string', 'd:relpath')
+        ('string', 'p:a')
+        ('string', 'p:e')
+        ('string', 'i:a')
+        ('string', 'i:e')
+        ('string', 'x:b')
         ('string', 'x:e'))))
 
 Test glob expansion of pats
@@ -1668,9 +1660,8 @@
       (func
         ('symbol', '_matchfiles')
         (list
-          (list
-            ('string', 'r:')
-            ('string', 'd:relpath'))
+          ('string', 'r:')
+          ('string', 'd:relpath')
           ('string', 'p:dir')))))
   $ hg up -q tip
 
@@ -1693,9 +1684,8 @@
       (func
         ('symbol', '_matchfiles')
         (list
-          (list
-            ('string', 'r:')
-            ('string', 'd:relpath'))
+          ('string', 'r:')
+          ('string', 'd:relpath')
           ('string', 'p:glob:*')))))
 
 Test --follow on a single rename
@@ -1836,9 +1826,8 @@
     (func
       ('symbol', '_matchfiles')
       (list
-        (list
-          ('string', 'r:')
-          ('string', 'd:relpath'))
+        ('string', 'r:')
+        ('string', 'd:relpath')
         ('string', 'p:set:copied()'))))
   $ testlog --include "set:copied()"
   []
@@ -1846,9 +1835,8 @@
     (func
       ('symbol', '_matchfiles')
       (list
-        (list
-          ('string', 'r:')
-          ('string', 'd:relpath'))
+        ('string', 'r:')
+        ('string', 'd:relpath')
         ('string', 'i:set:copied()'))))
   $ testlog -r "sort(file('set:copied()'), -rev)"
   ["sort(file('set:copied()'), -rev)"]
@@ -1865,9 +1853,8 @@
     (func
       ('symbol', '_matchfiles')
       (list
-        (list
-          ('string', 'r:')
-          ('string', 'd:relpath'))
+        ('string', 'r:')
+        ('string', 'd:relpath')
         ('string', 'p:a'))))
   $ testlog --removed --follow a
   []
@@ -1879,9 +1866,8 @@
       (func
         ('symbol', '_matchfiles')
         (list
-          (list
-            ('string', 'r:')
-            ('string', 'd:relpath'))
+          ('string', 'r:')
+          ('string', 'd:relpath')
           ('string', 'p:a')))))
 
 Test --patch and --stat with --follow and --follow-first
@@ -2271,9 +2257,8 @@
     (func
       ('symbol', '_matchfiles')
       (list
-        (list
-          ('string', 'r:')
-          ('string', 'd:relpath'))
+        ('string', 'r:')
+        ('string', 'd:relpath')
         ('string', 'p:.'))))
   $ testlog ../b
   []
--- a/tests/test-rebase-abort.t	Tue Jan 19 18:20:13 2016 +0000
+++ b/tests/test-rebase-abort.t	Sun Feb 07 00:49:31 2016 -0600
@@ -325,6 +325,78 @@
 
   $ cd ..
 
+test aborting an interrupted series (issue5084)
+  $ hg init interrupted
+  $ cd interrupted
+  $ touch base
+  $ hg add base
+  $ hg commit -m base
+  $ touch a
+  $ hg add a
+  $ hg commit -m a
+  $ echo 1 > a
+  $ hg commit -m 1
+  $ touch b
+  $ hg add b
+  $ hg commit -m b
+  $ echo 2 >> a
+  $ hg commit -m c
+  $ touch d
+  $ hg add d
+  $ hg commit -m d
+  $ hg co -q 1
+  $ hg rm a
+  $ hg commit -m no-a
+  created new head
+  $ hg co 0
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg log -G --template "{rev} {desc} {bookmarks}"
+  o  6 no-a
+  |
+  | o  5 d
+  | |
+  | o  4 c
+  | |
+  | o  3 b
+  | |
+  | o  2 1
+  |/
+  o  1 a
+  |
+  @  0 base
+  
+  $ hg --config extensions.n=$TESTDIR/failfilemerge.py rebase -s 3 -d tip
+  rebasing 3:3a71550954f1 "b"
+  rebasing 4:e80b69427d80 "c"
+  abort: ^C
+  [255]
+  $ hg rebase --abort
+  saved backup bundle to $TESTTMP/interrupted/.hg/strip-backup/3d8812cf300d-93041a90-backup.hg (glob)
+  rebase aborted
+  $ hg log -G --template "{rev} {desc} {bookmarks}"
+  o  6 no-a
+  |
+  | o  5 d
+  | |
+  | o  4 c
+  | |
+  | o  3 b
+  | |
+  | o  2 1
+  |/
+  o  1 a
+  |
+  @  0 base
+  
+  $ hg summary
+  parent: 0:df4f53cec30a 
+   base
+  branch: default
+  commit: (clean)
+  update: 6 new changesets (update)
+  phases: 7 draft
+
+  $ cd ..
 On the other hand, make sure we *do* clobber changes whenever we
 haven't somehow managed to update the repo to a different revision
 during a rebase (issue4661)
--- a/tests/test-revset.t	Tue Jan 19 18:20:13 2016 +0000
+++ b/tests/test-revset.t	Sun Feb 07 00:49:31 2016 -0600
@@ -1168,6 +1168,14 @@
   hg: parse error: can't use a list in this context
   (see hg help "revsets.x or y")
   [255]
+  $ try '0,1,2'
+  (list
+    ('symbol', '0')
+    ('symbol', '1')
+    ('symbol', '2'))
+  hg: parse error: can't use a list in this context
+  (see hg help "revsets.x or y")
+  [255]
 
 test that chained `or` operations make balanced addsets
 
@@ -1717,13 +1725,12 @@
   (func
     ('symbol', 'chainedorops')
     (list
-      (list
-        (range
-          ('symbol', '0')
-          ('symbol', '1'))
-        (range
-          ('symbol', '1')
-          ('symbol', '2')))
+      (range
+        ('symbol', '0')
+        ('symbol', '1'))
+      (range
+        ('symbol', '1')
+        ('symbol', '2'))
       (range
         ('symbol', '2')
         ('symbol', '3'))))
@@ -1877,9 +1884,8 @@
   (func
     ('symbol', 'rs')
     (list
-      (list
-        ('symbol', '2')
-        ('symbol', 'data'))
+      ('symbol', '2')
+      ('symbol', 'data')
       ('symbol', '7')))
   hg: parse error: invalid number of arguments: 3
   [255]
@@ -1887,13 +1893,11 @@
   (func
     ('symbol', 'rs4')
     (list
-      (list
-        (list
-          (or
-            ('symbol', '2')
-            ('symbol', '3'))
-          ('symbol', 'x'))
-        ('symbol', 'x'))
+      (or
+        ('symbol', '2')
+        ('symbol', '3'))
+      ('symbol', 'x')
+      ('symbol', 'x')
       ('symbol', 'date')))
   (func
     ('symbol', 'reverse')
@@ -2055,11 +2059,9 @@
   (func
     ('symbol', 'cat4')
     (list
-      (list
-        (list
-          ('symbol', '278')
-          ('string', '5f5'))
-        ('symbol', '1ee'))
+      ('symbol', '278')
+      ('string', '5f5')
+      ('symbol', '1ee')
       ('string', 'ce5')))
   (_concat
     (_concat