merge with stable
authorMatt Mackall <mpm@selenic.com>
Mon, 10 Aug 2015 15:30:28 -0500
changeset 25998 a7527c5769bb
parent 25994 d6beeb618700 (current diff)
parent 25997 d4e1e947444b (diff)
child 25999 1c75249e159b
merge with stable
hgext/convert/git.py
mercurial/fileset.py
mercurial/revset.py
tests/test-convert-git.t
tests/test-revset.t
--- a/hgext/convert/git.py	Sat Aug 08 18:52:59 2015 -0700
+++ b/hgext/convert/git.py	Mon Aug 10 15:30:28 2015 -0500
@@ -255,12 +255,18 @@
                 entry = l.split()
                 continue
             f = l
+            if entry[4][0] == 'C':
+                copysrc = f
+                copydest = difftree[i]
+                i += 1
+                f = copydest
+                copies[copydest] = copysrc
             if f not in seen:
                 add(entry, f, False)
             # A file can be copied multiple times, or modified and copied
             # simultaneously. So f can be repeated even if fdest isn't.
-            if entry[4][0] in 'RC':
-                # rename or copy: next line is the destination
+            if entry[4][0] == 'R':
+                # rename: next line is the destination
                 fdest = difftree[i]
                 i += 1
                 if fdest not in seen:
--- a/mercurial/fileset.py	Sat Aug 08 18:52:59 2015 -0700
+++ b/mercurial/fileset.py	Mon Aug 10 15:30:28 2015 -0500
@@ -295,7 +295,7 @@
 
 def _sizetomax(s):
     try:
-        s = s.strip()
+        s = s.strip().lower()
         for k, v in util._sizeunits:
             if s.endswith(k):
                 # max(4k) = 5k - 1, max(4.5k) = 4.6k - 1
--- a/mercurial/help/scripting.txt	Sat Aug 08 18:52:59 2015 -0700
+++ b/mercurial/help/scripting.txt	Mon Aug 10 15:30:28 2015 -0500
@@ -13,7 +13,7 @@
 - Calling out to a command server
 
 Executing ``hg`` processes is very similar to how humans interact with
-Mercurial in the shell. It should already be familar to you.
+Mercurial in the shell. It should already be familiar to you.
 
 :hg:`serve` can be used to start a server. By default, this will start
 a "hgweb" HTTP server. This HTTP server has support for machine-readable
--- a/mercurial/parsers.c	Sat Aug 08 18:52:59 2015 -0700
+++ b/mercurial/parsers.c	Mon Aug 10 15:30:28 2015 -0500
@@ -1113,6 +1113,7 @@
 	PyObject *phaseroots = NULL;
 	PyObject *phaseset = NULL;
 	PyObject *phasessetlist = NULL;
+	PyObject *rev = NULL;
 	Py_ssize_t len = index_length(self) - 1;
 	Py_ssize_t numphase = 0;
 	Py_ssize_t minrevallphases = 0;
@@ -1172,7 +1173,9 @@
 		 * is computed as a difference */
 		if (phase != 0) {
 			phaseset = PyList_GET_ITEM(phasessetlist, phase);
-			PySet_Add(phaseset, PyInt_FromLong(i));
+			rev = PyInt_FromLong(i);
+			PySet_Add(phaseset, rev);
+			Py_XDECREF(rev);
 		}
 		PyList_SET_ITEM(phaseslist, i, PyInt_FromLong(phase));
 	}
--- a/mercurial/revset.py	Sat Aug 08 18:52:59 2015 -0700
+++ b/mercurial/revset.py	Mon Aug 10 15:30:28 2015 -0500
@@ -2276,8 +2276,10 @@
         # (::x and not ::y)/(not ::y and ::x) have a fast path
         def isonly(revs, bases):
             return (
-                revs[0] == 'func'
+                revs is not None
+                and revs[0] == 'func'
                 and getstring(revs[1], _('not a symbol')) == 'ancestors'
+                and bases is not None
                 and bases[0] == 'not'
                 and bases[1][0] == 'func'
                 and getstring(bases[1][1], _('not a symbol')) == 'ancestors')
@@ -2309,7 +2311,7 @@
             del ss[:]
         for y in x[1:]:
             w, t = optimize(y, False)
-            if t[0] == 'string' or t[0] == 'symbol':
+            if t is not None and (t[0] == 'string' or t[0] == 'symbol'):
                 ss.append((w, t))
                 continue
             flushss()
--- a/tests/test-convert-git.t	Sat Aug 08 18:52:59 2015 -0700
+++ b/tests/test-convert-git.t	Mon Aug 10 15:30:28 2015 -0500
@@ -321,8 +321,9 @@
   $ cp bar bar-copied
   $ cp baz baz-copied
   $ cp baz baz-copied2
+  $ cp baz ba-copy
   $ echo baz2 >> baz
-  $ git add bar-copied baz-copied baz-copied2
+  $ git add bar-copied baz-copied baz-copied2 ba-copy
   $ commit -a -m 'rename and copy'
   $ cd ..
 
@@ -340,6 +341,8 @@
   $ hg -q convert --config convert.git.similarity=100 --datesort git-repo2 fullrepo
   $ hg -R fullrepo status -C --change master
   M baz
+  A ba-copy
+    baz
   A bar-copied
   A baz-copied
     baz
@@ -349,6 +352,13 @@
     foo
   R foo
 
+Ensure that the modification to the copy source was preserved
+(there was a bug where if the copy dest was alphabetically prior to the copy
+source, the copy source took the contents of the copy dest)
+  $ hg cat -r tip fullrepo/baz
+  baz
+  baz2
+
   $ cd git-repo2
   $ echo bar2 >> bar
   $ commit -a -m 'change bar'
--- a/tests/test-fileset.t	Sat Aug 08 18:52:59 2015 -0700
+++ b/tests/test-fileset.t	Mon Aug 10 15:30:28 2015 -0500
@@ -144,6 +144,8 @@
   2k
   $ fileset '(1k or 2k) and size(".5KB - 1.5kB")'
   1k
+  $ fileset 'size("1M")'
+  $ fileset 'size("1 GB")'
 
 Test merge states
 
--- a/tests/test-revset.t	Sat Aug 08 18:52:59 2015 -0700
+++ b/tests/test-revset.t	Mon Aug 10 15:30:28 2015 -0500
@@ -1186,6 +1186,20 @@
   4
   5
 
+no crash by empty group "()" while optimizing `or` operations
+
+  $ try --optimize '0|()'
+  (or
+    ('symbol', '0')
+    (group
+      None))
+  * optimized:
+  (or
+    ('symbol', '0')
+    None)
+  hg: parse error: missing argument
+  [255]
+
 test that chained `or` operations never eat up stack (issue4624)
 (uses `0:1` instead of `0` to avoid future optimization of trivial revisions)
 
@@ -1272,6 +1286,23 @@
   5
   6
 
+no crash by empty group "()" while optimizing to "only()"
+
+  $ try --optimize '::1 and ()'
+  (and
+    (dagrangepre
+      ('symbol', '1'))
+    (group
+      None))
+  * optimized:
+  (and
+    None
+    (func
+      ('symbol', 'ancestors')
+      ('symbol', '1')))
+  hg: parse error: missing argument
+  [255]
+
 we can use patterns when searching for tags
 
   $ log 'tag("1..*")'