changeset 14154:497493b777ad

merge with mpm
author Sune Foldager <cryo@cyanite.org>
date Sun, 01 May 2011 19:44:28 +0200
parents f8047a059ca0 (diff) 4b7e4b9db8fb (current diff)
children 921683f14ad7
files mercurial/localrepo.py
diffstat 10 files changed, 89 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/convert/hg.py	Sun May 01 16:54:48 2011 +0200
+++ b/hgext/convert/hg.py	Sun May 01 19:44:28 2011 +0200
@@ -287,10 +287,9 @@
         parents = self.parents(ctx)
         if not parents:
             files = sorted(ctx.manifest())
-            if self.ignoreerrors:
-                # calling getcopies() is a simple way to detect missing
-                # revlogs and populate self.ignored
-                self.getcopies(ctx, parents, files)
+            # getcopies() is not needed for roots, but it is a simple way to
+            # detect missing revlogs and abort on errors or populate self.ignored
+            self.getcopies(ctx, parents, files)
             return [(f, rev) for f in files if f not in self.ignored], {}
         if self._changescache and self._changescache[0] == rev:
             m, a, r = self._changescache[1]
--- a/hgext/convert/subversion.py	Sun May 01 16:54:48 2011 +0200
+++ b/hgext/convert/subversion.py	Sun May 01 19:44:28 2011 +0200
@@ -278,7 +278,10 @@
             raise util.Abort(_('svn: start revision %s is not an integer')
                              % self.startrev)
 
-        self.head = self.latest(self.module, latest)
+        try:
+            self.head = self.latest(self.module, latest)
+        except SvnPathNotFound:
+            self.head = None
         if not self.head:
             raise util.Abort(_('no revision found in module %s')
                              % self.module)
--- a/mercurial/httprepo.py	Sun May 01 16:54:48 2011 +0200
+++ b/mercurial/httprepo.py	Sun May 01 19:44:28 2011 +0200
@@ -128,7 +128,7 @@
         try:
             proto = resp.getheader('content-type')
         except AttributeError:
-            proto = resp.headers['content-type']
+            proto = resp.headers.get('content-type', '')
 
         safeurl = util.hidepassword(self._url)
         # accept old "text/plain" and "application/hg-changegroup" for now
@@ -139,7 +139,7 @@
             raise error.RepoError(
                 _("'%s' does not appear to be an hg repository:\n"
                   "---%%<--- (%s)\n%s\n---%%<---\n")
-                % (safeurl, proto, resp.read()))
+                % (safeurl, proto or 'no content-type', resp.read()))
 
         if proto.startswith('application/mercurial-'):
             try:
@@ -224,6 +224,10 @@
             # No luck, try older compatibility check.
             inst.between([(nullid, nullid)])
         return inst
-    except error.RepoError:
-        ui.note('(falling back to static-http)\n')
-        return statichttprepo.instance(ui, "static-" + path, create)
+    except error.RepoError, httpexception:
+        try:
+            r = statichttprepo.instance(ui, "static-" + path, create)
+            ui.note('(falling back to static-http)\n')
+            return r
+        except error.RepoError:
+            raise httpexception # use the original http RepoError instead
--- a/mercurial/localrepo.py	Sun May 01 16:54:48 2011 +0200
+++ b/mercurial/localrepo.py	Sun May 01 19:44:28 2011 +0200
@@ -1228,8 +1228,7 @@
                 if fn in mf1:
                     if (fn not in deleted and
                         (mf1.flags(fn) != mf2.flags(fn) or
-                         (mf1[fn] != mf2[fn] and
-                          (mf2[fn] or ctx1[fn].cmp(ctx2[fn]))))):
+                         mf1[fn] != mf2[fn])):
                         modified.append(fn)
                     elif listclean:
                         clean.append(fn)
--- a/mercurial/revset.py	Sun May 01 16:54:48 2011 +0200
+++ b/mercurial/revset.py	Sun May 01 19:44:28 2011 +0200
@@ -468,7 +468,9 @@
     except ValueError:
         # i18n: "limit" is a keyword
         raise error.ParseError(_("limit expects a number"))
-    return getset(repo, subset, l[0])[:lim]
+    ss = set(subset)
+    os = getset(repo, range(len(repo)), l[0])[:lim]
+    return [r for r in os if r in ss]
 
 def last(repo, subset, x):
     """``last(set, n)``
@@ -482,15 +484,17 @@
     except ValueError:
         # i18n: "last" is a keyword
         raise error.ParseError(_("last expects a number"))
-    return getset(repo, subset, l[0])[-lim:]
+    ss = set(subset)
+    os = getset(repo, range(len(repo)), l[0])[-lim:]
+    return [r for r in os if r in ss]
 
 def maxrev(repo, subset, x):
     """``max(set)``
     Changeset with highest revision number in set.
     """
-    s = getset(repo, subset, x)
-    if s:
-        m = max(s)
+    os = getset(repo, range(len(repo)), x)
+    if os:
+        m = max(os)
         if m in subset:
             return [m]
     return []
@@ -508,9 +512,9 @@
     """``min(set)``
     Changeset with lowest revision number in set.
     """
-    s = getset(repo, subset, x)
-    if s:
-        m = min(s)
+    os = getset(repo, range(len(repo)), x)
+    if os:
+        m = min(os)
         if m in subset:
             return [m]
     return []
--- a/mercurial/util.py	Sun May 01 16:54:48 2011 +0200
+++ b/mercurial/util.py	Sun May 01 19:44:28 2011 +0200
@@ -1319,7 +1319,7 @@
     return s
 
 class url(object):
-    """Reliable URL parser.
+    r"""Reliable URL parser.
 
     This parses URLs and provides attributes for the following
     components:
@@ -1350,8 +1350,8 @@
     <url scheme: 'bundle', path: 'foo'>
     >>> url('bundle://../foo')
     <url scheme: 'bundle', path: '../foo'>
-    >>> url('c:\\\\foo\\\\bar')
-    <url path: 'c:\\\\foo\\\\bar'>
+    >>> url(r'c:\foo\bar')
+    <url path: 'c:\\foo\\bar'>
 
     Authentication credentials:
 
@@ -1473,7 +1473,7 @@
         return '<url %s>' % ', '.join(attrs)
 
     def __str__(self):
-        """Join the URL's components back into a URL string.
+        r"""Join the URL's components back into a URL string.
 
         Examples:
 
@@ -1493,6 +1493,8 @@
         'bundle:../foo'
         >>> str(url('path'))
         'path'
+        >>> print url(r'bundle:foo\bar')
+        bundle:foo\bar
         """
         if self._localpath:
             s = self.path
--- a/tests/test-convert-filemap.t	Sun May 01 16:54:48 2011 +0200
+++ b/tests/test-convert-filemap.t	Sun May 01 19:44:28 2011 +0200
@@ -14,11 +14,13 @@
   $ mkdir -p dir/subdir
   $ echo dir/file >> dir/file
   $ echo dir/file2 >> dir/file2
+  $ echo dir/file3 >> dir/file3 # to be corrupted in rev 0
   $ echo dir/subdir/file3 >> dir/subdir/file3
   $ echo dir/subdir/file4 >> dir/subdir/file4
   $ hg ci -d '0 0' -qAm '0: add foo baz dir/'
   $ echo bar > bar
   $ echo quux > quux
+  $ echo dir/file4 >> dir/file4 # to be corrupted in rev 1
   $ hg copy foo copied
   $ hg ci -d '1 0' -qAm '1: add bar quux; copy foo to copied'
   $ echo >> foo
@@ -63,9 +65,9 @@
   | |
   o |  2 "2: change foo" files: foo
   |/
-  o  1 "1: add bar quux; copy foo to copied" files: bar copied quux
+  o  1 "1: add bar quux; copy foo to copied" files: bar copied dir/file4 quux
   |
-  o  0 "0: add foo baz dir/" files: baz dir/file dir/file2 dir/subdir/file3 dir/subdir/file4 foo
+  o  0 "0: add foo baz dir/" files: baz dir/file dir/file2 dir/file3 dir/subdir/file3 dir/subdir/file4 foo
   
 
 final file versions in this repo:
@@ -76,6 +78,8 @@
   7711d36246cc83e61fb29cd6d4ef394c63f1ceaf 644   copied
   3e20847584beff41d7cd16136b7331ab3d754be0 644   dir/file
   75e6d3f8328f5f6ace6bf10b98df793416a09dca 644   dir/file2
+  e96dce0bc6a217656a3a410e5e6bec2c4f42bf7c 644   dir/file3
+  6edd55f559cdce67132b12ca09e09cee08b60442 644   dir/file4
   5fe139720576e18e34bcc9f79174db8897c8afe9 644   dir/subdir/file3
   57a1c1511590f3de52874adfa04effe8a77d64af 644   dir/subdir/file4
   9a7b52012991e4873687192c3e17e61ba3e837a3 644   foo
@@ -234,7 +238,14 @@
   > exclude dir/subdir
   > include dir/subdir/file3
   > EOF
-  $ hg -q convert --filemap renames.fmap --datesort source renames.repo
+  $ rm source/.hg/store/data/dir/file3.i
+  $ rm source/.hg/store/data/dir/file4.i
+  $ hg -q convert --filemap renames.fmap --datesort source dummydest
+  abort: data/dir/file3.i@e96dce0bc6a2: no match found!
+  [255]
+  $ hg -q convert --filemap renames.fmap --datesort --config convert.hg.ignoreerrors=1 source renames.repo
+  ignoring: data/dir/file3.i@e96dce0bc6a2: no match found
+  ignoring: data/dir/file4.i@6edd55f559cd: no match found
   $ hg up -q -R renames.repo
   $ glog -R renames.repo
   @  4 "8: change foo" files: foo2
--- a/tests/test-convert-svn-source.t	Sun May 01 16:54:48 2011 +0200
+++ b/tests/test-convert-svn-source.t	Sun May 01 19:44:28 2011 +0200
@@ -107,6 +107,11 @@
   Committed revision 8.
   $ cd ..
 
+  $ hg convert -s svn "$svnurl/non-existent-path" dest
+  initializing destination dest repository
+  abort: no revision found in module /proj B/non-existent-path
+  [255]
+
 ########################################
 
 Test incremental conversion
--- a/tests/test-revset.t	Sun May 01 16:54:48 2011 +0200
+++ b/tests/test-revset.t	Sun May 01 19:44:28 2011 +0200
@@ -435,3 +435,11 @@
   ('func', ('symbol', 'reverse'), ('func', ('symbol', 'sort'), ('list', ('or', ('symbol', '2'), ('symbol', '3')), ('symbol', 'date'))))
   3
   2
+
+issue2549 - correct optimizations
+
+  $ log 'limit(1 or 2 or 3, 2) and not 2'
+  1
+  $ log 'max(1 or 2) and not 2'
+  $ log 'min(1 or 2) and not 1'
+  $ log 'last(1 or 2, 1) and not 2'
--- a/tests/test-status.t	Sun May 01 16:54:48 2011 +0200
+++ b/tests/test-status.t	Sun May 01 19:44:28 2011 +0200
@@ -272,3 +272,30 @@
     modified
   R removed
   C deleted
+
+hg status between revisions:
+
+  $ echo c1 > f1
+  $ hg ci -Amm f1
+  $ echo c2 > f1
+  $ echo c1 > f2
+  $ hg ci -Amm f1 f2
+  $ echo c1 > f1
+  $ hg st --rev -1:.
+  M f1
+  $ hg st --rev -2:.
+  M f1
+  A f2
+  $ hg ci -Amm f1
+  $ hg st --rev -1:-3
+  M f1
+  R f2
+  $ hg st --rev -3:-1
+  M f1
+  A f2
+  $ hg diff --rev -3:-1
+  diff -r c861ab34bf5f -r 168d05852219 f2
+  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/f2	Thu Jan 01 00:00:00 1970 +0000
+  @@ -0,0 +1,1 @@
+  +c1