changeset 21751:c5699c2d690b

merge with stable
author Matt Mackall <mpm@selenic.com>
date Fri, 13 Jun 2014 17:42:04 -0500
parents fecead61d222 (current diff) 4ab287c2d337 (diff)
children b7baef94a333
files tests/test-subrepo-git.t
diffstat 3 files changed, 25 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/parsers.c	Tue Jun 10 17:00:31 2014 -0700
+++ b/mercurial/parsers.c	Fri Jun 13 17:42:04 2014 -0500
@@ -1299,7 +1299,7 @@
 	static const Py_ssize_t capacity = 24;
 	int *depth, *interesting = NULL;
 	int i, j, v, ninteresting;
-	PyObject *dict = NULL, *keys;
+	PyObject *dict = NULL, *keys = NULL;
 	long *seen = NULL;
 	int maxrev = -1;
 	long final;
@@ -1403,8 +1403,10 @@
 		final |= i;
 		j -= 1;
 	}
-	if (final == 0)
-		return PyList_New(0);
+	if (final == 0) {
+		keys = PyList_New(0);
+		goto bail;
+	}
 
 	dict = PyDict_New();
 	if (dict == NULL)
@@ -1428,19 +1430,13 @@
 
 	keys = PyDict_Keys(dict);
 
-	free(depth);
-	free(seen);
-	free(interesting);
-	Py_DECREF(dict);
-
-	return keys;
 bail:
 	free(depth);
 	free(seen);
 	free(interesting);
 	Py_XDECREF(dict);
 
-	return NULL;
+	return keys;
 }
 
 /*
--- a/mercurial/revlog.py	Tue Jun 10 17:00:31 2014 -0700
+++ b/mercurial/revlog.py	Fri Jun 13 17:42:04 2014 -0500
@@ -919,8 +919,13 @@
 
         # preload the cache
         try:
-            self._chunkraw(revs[0], revs[-1])
-            offset, data = self._chunkcache
+            while 1:
+                # ensure that the cache doesn't change out from under us
+                _cache = self._chunkcache
+                self._chunkraw(revs[0], revs[-1])
+                if _cache == self._chunkcache:
+                    break
+            offset, data = _cache
         except OverflowError:
             # issue4215 - we can't cache a run of chunks greater than
             # 2G on Windows
@@ -967,13 +972,14 @@
             node = nodeorrev
             rev = None
 
+        _cache = self._cache # grab local copy of cache to avoid thread race
         cachedrev = None
         if node == nullid:
             return ""
-        if self._cache:
-            if self._cache[0] == node:
-                return self._cache[2]
-            cachedrev = self._cache[1]
+        if _cache:
+            if _cache[0] == node:
+                return _cache[2]
+            cachedrev = _cache[1]
 
         # look up what we need to read
         text = None
@@ -1001,7 +1007,7 @@
 
         if iterrev == cachedrev:
             # cache hit
-            text = self._cache[2]
+            text = _cache[2]
         else:
             chain.append(iterrev)
         chain.reverse()
--- a/tests/test-subrepo-git.t	Tue Jun 10 17:00:31 2014 -0700
+++ b/tests/test-subrepo-git.t	Fri Jun 13 17:42:04 2014 -0500
@@ -601,11 +601,9 @@
   8:3473d20bddcf
   $ grep ' s$' .hgsubstate
   c4069473b459cf27fd4d7c2f50c4346b4e936599 s
-  $ cat s/.hg/hgrc
-  cat: s/.hg/hgrc: No such file or directory
+  $ test -f s/.hg/hgrc
   [1]
-  $ cat s/sub/.hg/hgrc
-  cat: s/sub/.hg/hgrc: No such file or directory
+  $ test -f s/sub/.hg/hgrc
   [1]
   $ cd ..
 
@@ -636,11 +634,9 @@
 
   $ cd tc
   $ hg update -q -C af6d2edbb0d3
-  $ cat s/.hg/hgrc
-  cat: s/.hg/hgrc: No such file or directory
+  $ test -f s/.hg/hgrc
   [1]
-  $ cat s/sub/.hg/hgrc
-  cat: s/sub/.hg/hgrc: No such file or directory
+  $ test -f s/sub/.hg/hgrc
   [1]
   $ cd ..
   $ hg -R tc pull -q
@@ -652,11 +648,9 @@
   9:ed23f7fe024e
   $ grep ' s$' .hgsubstate
   f262643c1077219fbd3858d54e78ef050ef84fbf s
-  $ cat s/.hg/hgrc
-  cat: s/.hg/hgrc: No such file or directory
+  $ test -f s/.hg/hgrc
   [1]
-  $ cat s/sub/.hg/hgrc
-  cat: s/sub/.hg/hgrc: No such file or directory
+  $ test -f s/sub/.hg/hgrc
   [1]
 
 Test that sanitizing is omitted in meta data area: