merge with stable
authorMatt Mackall <mpm@selenic.com>
Thu, 09 Jun 2016 13:47:42 -0500
changeset 29328 60621cecc8c5
parent 29327 baab9ea4426c (current diff)
parent 29323 d29cb5e735e9 (diff)
child 29330 12c97985ddeb
merge with stable
tests/test-subrepo-git.t
--- a/.hgsigs	Tue Jun 07 11:57:11 2016 +0200
+++ b/.hgsigs	Thu Jun 09 13:47:42 2016 -0500
@@ -127,3 +127,4 @@
 f85de28eae32e7d3064b1a1321309071bbaaa069 0 iQIVAwUAVyZQaiBXgaxoKi1yAQJhCQ//WrRZ55k3VI/OgY+I/HvgFHOC0sbhe207Kedxvy00a3AtXM6wa5E95GNX04QxUfTWUf5ZHDfEgj0/mQywNrH1oJG47iPZSs+qXNLqtgAaXtrih6r4/ruUwFCRFxqK9mkhjG61SKicw3Q7uGva950g6ZUE5BsZ7XJWgoDcJzWKR+AH992G6H//Fhi4zFQAmB34++sm80wV6wMxVKA/qhQzetooTR2x9qrHpvCKMzKllleJe48yzPLJjQoaaVgXCDav0eIePFNw0WvVSldOEp/ADDdTGa65qsC1rO2BB1Cu5+frJ/vUoo0PwIgqgD6p2i41hfIKvkp6130TxmRVxUx+ma8gBYEpPIabV0flLU72gq8lMlGBBSnQ+fcZsfs/Ug0xRN0tzkEScmZFiDxRGk0y7IalXzv6irwOyC2fZCajXGJDzkROQXWMgy9eKkwuFhZBmPVYtrATSq3jHLVmJg5vfdeiVzA6NKxAgGm2z8AsRrijKK8WRqFYiH6xcWKG5u+FroPQdKa0nGCkPSTH3tvC6fAHTVm7JeXch5QE/LiS9Y575pM2PeIP+k+Fr1ugK0AEvYJAXa5UIIcdszPyI+TwPTtWaQ83X99qGAdmRWLvSYjqevOVr7F/fhO3XKFXRCcHA3EzVYnG7nWiVACYF3H2UgN4PWjStbx/Qhhdi9xAuks=
 a56296f55a5e1038ea5016dace2076b693c28a56 0 iQIVAwUAVyZarCBXgaxoKi1yAQL87g/8D7whM3e08HVGDHHEkVUgqLIfueVy1mx0AkRvelm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57:11 2016 +0200
+++ b/.hgtags	Thu Jun 09 13:47:42 2016 -0500
@@ -140,3 +140,4 @@
 f85de28eae32e7d3064b1a1321309071bbaaa069 3.8
 a56296f55a5e1038ea5016dace2076b693c28a56 3.8.1
 aaabed77791a75968a12b8c43ad263631a23ee81 3.8.2
+a9764ab80e11bcf6a37255db7dd079011f767c6c 3.8.3
--- a/mercurial/bdiff.c	Tue Jun 07 11:57:11 2016 +0200
+++ b/mercurial/bdiff.c	Thu Jun 09 13:47:42 2016 -0500
@@ -148,7 +148,7 @@
 static int longest_match(struct line *a, struct line *b, struct pos *pos,
 			 int a1, int a2, int b1, int b2, int *omi, int *omj)
 {
-	int mi = a1, mj = b1, mk = 0, mb = 0, i, j, k, half;
+	int mi = a1, mj = b1, mk = 0, i, j, k, half;
 
 	/* window our search on large regions to better bound
 	   worst-case performance. by choosing a window at the end, we
@@ -166,10 +166,17 @@
 		/* loop through all lines match a[i] in b */
 		for (; j >= b1; j = b[j].n) {
 			/* does this extend an earlier match? */
-			if (i > a1 && j > b1 && pos[j - 1].pos == i - 1)
-				k = pos[j - 1].len + 1;
-			else
-				k = 1;
+			for (k = 1; j - k >= b1 && i - k >= a1; k++) {
+				/* reached an earlier match? */
+				if (pos[j - k].pos == i - k) {
+					k += pos[j - k].len;
+					break;
+				}
+				/* previous line mismatch? */
+				if (a[i - k].e != b[j - k].e)
+					break;
+			}
+
 			pos[j].pos = i;
 			pos[j].len = k;
 
@@ -188,18 +195,15 @@
 		mj = mj - mk + 1;
 	}
 
-	/* expand match to include neighboring popular lines */
-	while (mi - mb > a1 && mj - mb > b1 &&
-	       a[mi - mb - 1].e == b[mj - mb - 1].e)
-		mb++;
+	/* expand match to include subsequent popular lines */
 	while (mi + mk < a2 && mj + mk < b2 &&
 	       a[mi + mk].e == b[mj + mk].e)
 		mk++;
 
-	*omi = mi - mb;
-	*omj = mj - mb;
+	*omi = mi;
+	*omj = mj;
 
-	return mk + mb;
+	return mk;
 }
 
 static struct hunk *recurse(struct line *a, struct line *b, struct pos *pos,
--- a/mercurial/bundle2.py	Tue Jun 07 11:57:11 2016 +0200
+++ b/mercurial/bundle2.py	Thu Jun 09 13:47:42 2016 -0500
@@ -1453,7 +1453,7 @@
     # Trigger a transaction so that we are guaranteed to have the lock now.
     if op.ui.configbool('experimental', 'bundle2lazylocking'):
         op.gettransaction()
-    if heads != op.repo.heads():
+    if sorted(heads) != sorted(op.repo.heads()):
         raise error.PushRaced('repository changed while pushing - '
                               'please try again')
 
--- a/mercurial/manifest.c	Tue Jun 07 11:57:11 2016 +0200
+++ b/mercurial/manifest.c	Thu Jun 09 13:47:42 2016 -0500
@@ -861,7 +861,7 @@
 	{"iterkeys", (PyCFunction)lazymanifest_getkeysiter, METH_NOARGS,
 	 "Iterate over file names in this lazymanifest."},
 	{"iterentries", (PyCFunction)lazymanifest_getentriesiter, METH_NOARGS,
-	 "Iterate over (path, nodeid, flags) typles in this lazymanifest."},
+	 "Iterate over (path, nodeid, flags) tuples in this lazymanifest."},
 	{"copy", (PyCFunction)lazymanifest_copy, METH_NOARGS,
 	 "Make a copy of this lazymanifest."},
 	{"filtercopy", (PyCFunction)lazymanifest_filtercopy, METH_O,
--- a/tests/test-cache-abuse.t	Tue Jun 07 11:57:11 2016 +0200
+++ b/tests/test-cache-abuse.t	Thu Jun 09 13:47:42 2016 -0500
@@ -88,7 +88,7 @@
   $ damage "log -qr branch(b2)" rbc-names-v1
   --- before	* (glob)
   +++ after	* (glob)
-  @@ -1,8 +0,0 @@
+  @@ -1,8 +?,0 @@ (glob)
   -2:5fb7d38b9dc4
   -3:60b597ffdafa
   -4:b1174d11b69e
--- a/tests/test-subrepo-git.t	Tue Jun 07 11:57:11 2016 +0200
+++ b/tests/test-subrepo-git.t	Thu Jun 09 13:47:42 2016 -0500
@@ -1135,7 +1135,7 @@
 test for Git CVE-2016-3068
   $ hg init malicious-subrepository
   $ cd malicious-subrepository
-  $ echo "s = [git]ext::sh -c echo% pwned% >&2" > .hgsub
+  $ echo "s = [git]ext::sh -c echo% pwned:% \$PWNED_MSG% >pwned.txt" > .hgsub
   $ git init s
   Initialized empty Git repository in $TESTTMP/tc/malicious-subrepository/s/.git/
   $ cd s
@@ -1145,24 +1145,31 @@
   $ hg add .hgsub
   $ hg commit -m "add subrepo"
   $ cd ..
+  $ rm -f pwned.txt
   $ unset GIT_ALLOW_PROTOCOL
-  $ hg clone malicious-subrepository malicious-subrepository-protected
+  $ PWNED_MSG="your git is too old or mercurial has regressed" hg clone \
+  > malicious-subrepository malicious-subrepository-protected
   Cloning into '$TESTTMP/tc/malicious-subrepository-protected/s'... (glob)
   fatal: transport 'ext' not allowed
   updating to branch default
-  cloning subrepo s from ext::sh -c echo% pwned% >&2
+  cloning subrepo s from ext::sh -c echo% pwned:% $PWNED_MSG% >pwned.txt
   abort: git clone error 128 in s (in subrepo s)
   [255]
+  $ f -Dq pwned.txt
+  pwned.txt: file not found
 
 whitelisting of ext should be respected (that's the git submodule behaviour)
-  $ env GIT_ALLOW_PROTOCOL=ext hg clone malicious-subrepository malicious-subrepository-clone-allowed
+  $ rm -f pwned.txt
+  $ env GIT_ALLOW_PROTOCOL=ext PWNED_MSG="you asked for it" hg clone \
+  > malicious-subrepository malicious-subrepository-clone-allowed
   Cloning into '$TESTTMP/tc/malicious-subrepository-clone-allowed/s'... (glob)
-  pwned
   fatal: Could not read from remote repository.
   
   Please make sure you have the correct access rights
   and the repository exists.
   updating to branch default
-  cloning subrepo s from ext::sh -c echo% pwned% >&2
+  cloning subrepo s from ext::sh -c echo% pwned:% $PWNED_MSG% >pwned.txt
   abort: git clone error 128 in s (in subrepo s)
   [255]
+  $ f -Dq pwned.txt
+  pwned: you asked for it