Merge with stable
authorPatrick Mezard <pmezard@gmail.com>
Fri, 24 Sep 2010 00:17:04 +0200
changeset 12394 9d45f78c465b
parent 12390 aff4afdcfd2b (current diff)
parent 12393 84ceedcfeb6a (diff)
child 12398 2bc926ad65c2
Merge with stable
hgext/bookmarks.py
mercurial/url.py
tests/test-bookmarks-strip.t
--- a/hgext/bookmarks.py	Thu Sep 23 16:31:38 2010 +0200
+++ b/hgext/bookmarks.py	Fri Sep 24 00:17:04 2010 +0200
@@ -224,6 +224,7 @@
             in the .hg/bookmarks file.
             Read the file and return a (name=>nodeid) dictionary
             '''
+            self._loadingbookmarks = True
             try:
                 bookmarks = {}
                 for line in self.opener('bookmarks'):
@@ -231,6 +232,7 @@
                     bookmarks[refspec] = super(bookmark_repo, self).lookup(sha)
             except:
                 pass
+            self._loadingbookmarks = False
             return bookmarks
 
         @util.propertycache
@@ -257,8 +259,9 @@
             return super(bookmark_repo, self).rollback(*args)
 
         def lookup(self, key):
-            if key in self._bookmarks:
-                key = self._bookmarks[key]
+            if not getattr(self, '_loadingbookmarks', False):
+                if key in self._bookmarks:
+                    key = self._bookmarks[key]
             return super(bookmark_repo, self).lookup(key)
 
         def _bookmarksupdate(self, parents, node):
@@ -357,7 +360,8 @@
         def _findtags(self):
             """Merge bookmarks with normal tags"""
             (tags, tagtypes) = super(bookmark_repo, self)._findtags()
-            tags.update(self._bookmarks)
+            if not getattr(self, '_loadingbookmarks', False):
+                tags.update(self._bookmarks)
             return (tags, tagtypes)
 
         if hasattr(repo, 'invalidate'):
--- a/hgext/convert/darcs.py	Thu Sep 23 16:31:38 2010 +0200
+++ b/hgext/convert/darcs.py	Fri Sep 24 00:17:04 2010 +0200
@@ -8,7 +8,7 @@
 from common import NoRepo, checktool, commandline, commit, converter_source
 from mercurial.i18n import _
 from mercurial import util
-import os, shutil, tempfile
+import os, shutil, tempfile, re
 
 # The naming drift of ElementTree is fun!
 
@@ -31,11 +31,8 @@
         converter_source.__init__(self, ui, path, rev=rev)
         commandline.__init__(self, ui, 'darcs')
 
-        # check for _darcs, ElementTree, _darcs/inventory so that we can
-        # easily skip test-convert-darcs if ElementTree is not around
-        if not os.path.exists(os.path.join(path, '_darcs', 'inventories')):
-            raise NoRepo(_("%s does not look like a darcs repository") % path)
-
+        # check for _darcs, ElementTree so that we can easily skip
+        # test-convert-darcs if ElementTree is not around
         if not os.path.exists(os.path.join(path, '_darcs')):
             raise NoRepo(_("%s does not look like a darcs repository") % path)
 
@@ -55,6 +52,15 @@
         self.parents = {}
         self.tags = {}
 
+        # Check darcs repository format
+        format = self.format()
+        if format:
+            if format in ('darcs-1.0', 'hashed'):
+                raise NoRepo(_("%s repository format is unsupported, "
+                               "please upgrade") % format)
+        else:
+            self.ui.warn(_('failed to detect repository format!'))
+
     def before(self):
         self.tmppath = tempfile.mkdtemp(
             prefix='convert-' + os.path.basename(self.path) + '-')
@@ -91,6 +97,15 @@
         self.checkexit(fp.close())
         return etree.getroot()
 
+    def format(self):
+        output, status = self.run('show', 'repo', no_files=True,
+                                  repodir=self.path)
+        self.checkexit(status)
+        m = re.search(r'^\s*Format:\s*(.*)$', output, re.MULTILINE)
+        if not m:
+            return None
+        return ','.join(sorted(f.strip() for f in m.group(1).split(',')))
+
     def manifest(self):
         man = []
         output, status = self.run('show', 'files', no_directories=True,
--- a/mercurial/url.py	Thu Sep 23 16:31:38 2010 +0200
+++ b/mercurial/url.py	Fri Sep 24 00:17:04 2010 +0200
@@ -486,9 +486,6 @@
         _generic_start_transaction(self, h, req)
         return keepalive.HTTPHandler._start_transaction(self, h, req)
 
-    def __del__(self):
-        self.close_all()
-
 if has_https:
     class BetterHTTPS(httplib.HTTPSConnection):
         send = keepalive.safesend
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/darcs/darcs1/_darcs/inventory	Fri Sep 24 00:17:04 2010 +0200
@@ -0,0 +1,2 @@
+[adda
+test@test.com**20100923184058] 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/darcs/darcs1/_darcs/prefs/author	Fri Sep 24 00:17:04 2010 +0200
@@ -0,0 +1,1 @@
+test@test.com
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/darcs/darcs1/_darcs/prefs/binaries	Fri Sep 24 00:17:04 2010 +0200
@@ -0,0 +1,59 @@
+# Binary file regexps:
+\.png$
+\.PNG$
+\.gz$
+\.GZ$
+\.pdf$
+\.PDF$
+\.jpg$
+\.JPG$
+\.jpeg$
+\.JPEG$
+\.gif$
+\.GIF$
+\.tif$
+\.TIF$
+\.tiff$
+\.TIFF$
+\.pnm$
+\.PNM$
+\.pbm$
+\.PBM$
+\.pgm$
+\.PGM$
+\.ppm$
+\.PPM$
+\.bmp$
+\.BMP$
+\.mng$
+\.MNG$
+\.tar$
+\.TAR$
+\.bz2$
+\.BZ2$
+\.z$
+\.Z$
+\.zip$
+\.ZIP$
+\.jar$
+\.JAR$
+\.so$
+\.SO$
+\.a$
+\.A$
+\.tgz$
+\.TGZ$
+\.mpg$
+\.MPG$
+\.mpeg$
+\.MPEG$
+\.iso$
+\.ISO$
+\.exe$
+\.EXE$
+\.doc$
+\.DOC$
+\.elc$
+\.ELC$
+\.pyc$
+\.PYC$
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/darcs/darcs1/_darcs/prefs/boring	Fri Sep 24 00:17:04 2010 +0200
@@ -0,0 +1,49 @@
+# Boring file regexps:
+\.hi$
+\.hi-boot$
+\.o-boot$
+\.o$
+\.o\.cmd$
+# *.ko files aren't boring by default because they might
+# be Korean translations rather than kernel modules.
+# \.ko$
+\.ko\.cmd$
+\.mod\.c$
+(^|/)\.tmp_versions($|/)
+(^|/)CVS($|/)
+\.cvsignore$
+^\.#
+(^|/)RCS($|/)
+,v$
+(^|/)\.svn($|/)
+\.bzr$
+(^|/)SCCS($|/)
+~$
+(^|/)_darcs($|/)
+\.bak$
+\.BAK$
+\.orig$
+\.rej$
+(^|/)vssver\.scc$
+\.swp$
+(^|/)MT($|/)
+(^|/)\{arch\}($|/)
+(^|/).arch-ids($|/)
+(^|/),
+\.prof$
+(^|/)\.DS_Store$
+(^|/)BitKeeper($|/)
+(^|/)ChangeSet($|/)
+\.py[co]$
+\.elc$
+\.class$
+\#
+(^|/)Thumbs\.db$
+(^|/)autom4te\.cache($|/)
+(^|/)config\.(log|status)$
+^\.depend$
+(^|/)(tags|TAGS)$
+#(^|/)\.[^/]
+(^|/|\.)core$
+\.(obj|a|exe|so|lo|la)$
+^\.darcs-temp-mail$
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/darcs/darcs1/_darcs/pristine/a	Fri Sep 24 00:17:04 2010 +0200
@@ -0,0 +1,1 @@
+a 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/darcs/darcs1/a	Fri Sep 24 00:17:04 2010 +0200
@@ -0,0 +1,1 @@
+a 
--- a/tests/test-bookmarks-strip.t	Thu Sep 23 16:31:38 2010 +0200
+++ b/tests/test-bookmarks-strip.t	Fri Sep 24 00:17:04 2010 +0200
@@ -58,3 +58,30 @@
    * test                      1:8cf31af87a2b
    * test2                     1:8cf31af87a2b
 
+immediate rollback and reentrancy issue
+
+  $ echo "mq=!" >> $HGRCPATH
+  $ hg init repo
+  $ cd repo
+  $ echo a > a
+  $ hg ci -Am adda
+  adding a
+  $ echo b > b
+  $ hg ci -Am addb
+  adding b
+  $ hg bookmarks markb
+  $ hg rollback
+  rolling back to revision 0 (undo commit)
+
+are you there?
+
+  $ hg bookmarks
+  no bookmarks set
+
+can you be added again?
+
+  $ hg bookmarks markb
+  $ hg bookmarks
+   * markb                     0:07f494440405
+  $ cd ..
+
--- a/tests/test-convert-darcs	Thu Sep 23 16:31:38 2010 +0200
+++ b/tests/test-convert-darcs	Fri Sep 24 00:17:04 2010 +0200
@@ -17,6 +17,9 @@
     exit 80
 fi
 
+echo '% try converting darcs1 repository'
+hg convert -s darcs "$TESTDIR/darcs/darcs1" 2>&1 | grep darcs-1.0
+
 echo % initialize darcs repo
 mkdir darcs-repo
 cd darcs-repo
--- a/tests/test-convert-darcs.out	Thu Sep 23 16:31:38 2010 +0200
+++ b/tests/test-convert-darcs.out	Fri Sep 24 00:17:04 2010 +0200
@@ -1,3 +1,5 @@
+% try converting darcs1 repository
+darcs-1.0 repository format is unsupported, please upgrade
 % initialize darcs repo
 Finished recording patch 'p0'
 % branch and update