merge with stable
authorMatt Mackall <mpm@selenic.com>
Mon, 05 Dec 2011 17:48:40 -0600
changeset 15611 ec8a49c46d7e
parent 15606 2ad4e9b44d8b (current diff)
parent 15610 09b200396384 (diff)
child 15612 6f2eee68f6a5
merge with stable
contrib/check-code.py
hgext/convert/common.py
mercurial/commands.py
mercurial/localrepo.py
mercurial/util.py
tests/test-url.py
--- a/contrib/check-code.py	Fri Dec 02 18:36:32 2011 +0100
+++ b/contrib/check-code.py	Mon Dec 05 17:48:40 2011 -0600
@@ -88,7 +88,7 @@
     (r'^(\S|  $ ).*(\S[ \t]+|^[ \t]+)\n', "trailing whitespace on non-output"),
     (uprefix + r'.*\|\s*sed', "use regex test output patterns instead of sed"),
     (uprefix + r'(true|exit 0)', "explicit zero exit unnecessary"),
-    (uprefix + r'.*\$\?', "explicit exit code checks unnecessary"),
+    (uprefix + r'.*(?<!\[)\$\?', "explicit exit code checks unnecessary"),
     (uprefix + r'.*\|\| echo.*(fail|error)',
      "explicit exit code checks unnecessary"),
     (uprefix + r'set -e', "don't use set -e"),
--- a/hgext/convert/common.py	Fri Dec 02 18:36:32 2011 +0100
+++ b/hgext/convert/common.py	Mon Dec 05 17:48:40 2011 -0600
@@ -382,7 +382,7 @@
             return
         for i, line in enumerate(fp):
             try:
-                key, value = line.splitlines()[0].rsplit(' ', 1)
+                key, value = line.splitlines()[0].rstrip().rsplit(' ', 1)
             except ValueError:
                 raise util.Abort(
                     _('syntax error in %s(%d): key/value pair expected')
--- a/hgext/schemes.py	Fri Dec 02 18:36:32 2011 +0100
+++ b/hgext/schemes.py	Mon Dec 05 17:48:40 2011 -0600
@@ -72,9 +72,10 @@
         return hg._peerlookup(url).instance(ui, url, create)
 
 def hasdriveletter(orig, path):
-    for scheme in schemes:
-        if path.startswith(scheme + ':'):
-            return False
+    if path:
+        for scheme in schemes:
+            if path.startswith(scheme + ':'):
+                return False
     return orig(path)
 
 schemes = {
--- a/mercurial/commands.py	Fri Dec 02 18:36:32 2011 +0100
+++ b/mercurial/commands.py	Mon Dec 05 17:48:40 2011 -0600
@@ -826,6 +826,11 @@
 def branch(ui, repo, label=None, **opts):
     """set or show the current branch name
 
+    .. note::
+       Branch names are permanent and global. Use :hg:`bookmark` to create a
+       light-weight bookmark instead. See :hg:`help glossary` for more
+       information about named branches and bookmarks.
+
     With no argument, show the current branch name. With one argument,
     set the working directory branch name (the branch will not exist
     in the repository until the next commit). Standard practice
@@ -842,11 +847,6 @@
     Use the command :hg:`update` to switch to an existing branch. Use
     :hg:`commit --close-branch` to mark this branch as closed.
 
-    .. note::
-       Branch names are permanent. Use :hg:`bookmark` to create a
-       light-weight bookmark instead. See :hg:`help glossary` for more
-       information about named branches and bookmarks.
-
     Returns 0 on success.
     """
 
--- a/mercurial/localrepo.py	Fri Dec 02 18:36:32 2011 +0100
+++ b/mercurial/localrepo.py	Mon Dec 05 17:48:40 2011 -0600
@@ -852,7 +852,6 @@
                         % self.dirstate.branch())
 
             self.dirstate.invalidate()
-            self.destroyed()
             parents = tuple([p.rev() for p in self.parents()])
             if len(parents) > 1:
                 ui.status(_('working directory now based on '
@@ -860,6 +859,7 @@
             else:
                 ui.status(_('working directory now based on '
                             'revision %d\n') % parents)
+        self.destroyed()
         return 0
 
     def invalidatecaches(self):
--- a/mercurial/util.py	Fri Dec 02 18:36:32 2011 +0100
+++ b/mercurial/util.py	Mon Dec 05 17:48:40 2011 -0600
@@ -1629,6 +1629,8 @@
         'path'
         >>> str(url('file:///tmp/foo/bar'))
         'file:///tmp/foo/bar'
+        >>> str(url('file:///c:/tmp/foo/bar'))
+        'file:///c:/tmp/foo/bar'
         >>> print url(r'bundle:foo\bar')
         bundle:foo\bar
         """
@@ -1643,8 +1645,11 @@
         s = self.scheme + ':'
         if self.user or self.passwd or self.host:
             s += '//'
-        elif self.scheme and (not self.path or self.path.startswith('/')):
+        elif self.scheme and (not self.path or self.path.startswith('/')
+                              or hasdriveletter(self.path)):
             s += '//'
+            if hasdriveletter(self.path):
+                s += '/'
         if self.user:
             s += urllib.quote(self.user, safe=self._safechars)
         if self.passwd:
@@ -1716,7 +1721,7 @@
     return bool(url(path).scheme)
 
 def hasdriveletter(path):
-    return path[1:2] == ':' and path[0:1].isalpha()
+    return path and path[1:2] == ':' and path[0:1].isalpha()
 
 def urllocalpath(path):
     return url(path, parsequery=False, parsefragment=False).localpath()
--- a/tests/test-convert-splicemap.t	Fri Dec 02 18:36:32 2011 +0100
+++ b/tests/test-convert-splicemap.t	Mon Dec 05 17:48:40 2011 -0600
@@ -49,7 +49,7 @@
 splice repo2 on repo1
 
   $ cat > splicemap <<EOF
-  > $CHILDID1 $PARENTID1
+  > $CHILDID1 $PARENTID1 
   > $CHILDID2 $PARENTID2,$CHILDID1
   > EOF
   $ hg clone repo1 target1
--- a/tests/test-subrepo-svn.t	Fri Dec 02 18:36:32 2011 +0100
+++ b/tests/test-subrepo-svn.t	Mon Dec 05 17:48:40 2011 -0600
@@ -37,8 +37,7 @@
   Adding         src/alpha
   Transmitting file data ..
   Committed revision 1.
-  $ svn up
-  At revision 1.
+  $ svn up -q
   $ echo "externals -r1 $SVNREPO/externals" > extdef
   $ svn propset -F extdef svn:externals src
   property 'svn:externals' set on 'src'
@@ -105,13 +104,13 @@
   branch: default
   commit: 1 modified, 1 subrepos
   update: (current)
-  $ hg commit --subrepos -m 'Message!'
+  $ hg commit --subrepos -m 'Message!' | grep -v Updating
   committing subrepository s
   Sending*s/alpha (glob)
   Transmitting file data .
   Committed revision 3.
   
-  Fetching external item into '$TESTTMP/sub/t/s/externals'
+  Fetching external item into '*s/externals'* (glob)
   External at revision 1.
   
   At revision 3.
@@ -129,12 +128,7 @@
   $ svn mkdir "$SVNREPO/unrelated" -m 'create unrelated'
   
   Committed revision 4.
-  $ svn up s
-  
-  Fetching external item into 's/externals'
-  External at revision 1.
-  
-  At revision 4.
+  $ svn up -q s
   $ hg sum
   parent: 2:* tip (glob)
    Message!
@@ -151,19 +145,12 @@
 add a commit from svn
 
   $ cd "$WCROOT"/src
-  $ svn up
-  U    alpha
-  
-  Fetching external item into 'externals'
-  A    externals/other
-  Updated external to revision 1.
-  
-  Updated to revision 4.
+  $ svn up -q
   $ echo xyz >> alpha
   $ svn propset svn:mime-type 'text/xml' alpha
   property 'svn:mime-type' set on 'alpha'
   $ svn ci -m 'amend a from svn'
-  Sending        src/alpha
+  Sending        *alpha (glob)
   Transmitting file data .
   Committed revision 5.
   $ cd ../../sub/t
@@ -171,10 +158,9 @@
 this commit from hg will fail
 
   $ echo zzz >> s/alpha
-  $ hg ci --subrepos -m 'amend alpha from hg'
+  $ (hg ci --subrepos -m 'amend alpha from hg' 2>&1; echo "[$?]") | grep -vi 'out of date'
   committing subrepository s
-  abort: svn: Commit failed (details follow):
-  svn: (Out of date)?.*/src/alpha.*(is out of date)? (re)
+  abort: svn:*Commit failed (details follow): (glob)
   [255]
   $ svn revert -q s/alpha
 
@@ -182,10 +168,9 @@
 
   $ svn propset svn:mime-type 'text/html' s/alpha
   property 'svn:mime-type' set on 's/alpha'
-  $ hg ci --subrepos -m 'amend alpha from hg'
+  $ (hg ci --subrepos -m 'amend alpha from hg' 2>&1; echo "[$?]") | grep -vi 'out of date'
   committing subrepository s
-  abort: svn: Commit failed (details follow):
-  svn: (Out of date)?.*/src/alpha.*(is out of date)? (re)
+  abort: svn:*Commit failed (details follow): (glob)
   [255]
   $ svn revert -q s/alpha
 
@@ -228,7 +213,7 @@
   A    tc/s/alpha
    U   tc/s
   
-  Fetching external item into 'tc/s/externals'
+  Fetching external item into 'tc/s/externals'* (glob)
   A    tc/s/externals/other
   Checked out external at revision 1.
   
@@ -236,7 +221,7 @@
   A    tc/subdir/s/alpha
    U   tc/subdir/s
   
-  Fetching external item into 'tc/subdir/s/externals'
+  Fetching external item into 'tc/subdir/s/externals'* (glob)
   A    tc/subdir/s/externals/other
   Checked out external at revision 1.
   
@@ -272,18 +257,18 @@
   $ echo c1 > f1
   $ echo c1 > f2
   $ svn add f1 -q
-  $ svn status
+  $ svn status | sort
+  
   ? *    a (glob)
-  X *    externals (glob)
   ? *    f2 (glob)
+  A *    f1 (glob)
   M *    alpha (glob)
-  A *    f1 (glob)
-  
-  Performing status on external item at 'externals'
+  Performing status on external item at 'externals'* (glob)
+  X *    externals (glob)
   $ cd ../..
   $ hg -R t update -C
   
-  Fetching external item into 't/s/externals'
+  Fetching external item into 't/s/externals'* (glob)
   Checked out external at revision 1.
   
   Checked out revision 3.
@@ -295,7 +280,7 @@
   ? *    f1 (glob)
   ? *    f2 (glob)
   
-  Performing status on external item at 'externals'
+  Performing status on external item at 'externals'* (glob)
 
 Sticky subrepositories, no changes
   $ cd $TESTTMP/sub/t
@@ -306,9 +291,9 @@
   3
   $ cd ..
   $ hg update 1
-  U    $TESTTMP/sub/t/s/alpha
+  U    *s/alpha (glob)
   
-  Fetching external item into '$TESTTMP/sub/t/s/externals'
+  Fetching external item into '*s/externals'* (glob)
   Checked out external at revision 1.
   
   Checked out revision 2.
@@ -344,9 +329,9 @@
   2M
   $ cd ..
   $ hg update --clean tip
-  U    $TESTTMP/sub/t/s/alpha
+  U    *s/alpha (glob)
   
-  Fetching external item into '$TESTTMP/sub/t/s/externals'
+  Fetching external item into '*s/externals'* (glob)
   Checked out external at revision 1.
   
   Checked out revision 3.
@@ -360,14 +345,7 @@
   3
   $ cd ..
   $ cd s
-  $ svn update -r 1
-  U    alpha
-   U   .
-  
-  Fetching external item into 'externals'
-  Updated external to revision 1.
-  
-  Updated to revision 1.
+  $ svn update -qr 1
   $ cd ..
   $ hg update 1
    subrepository sources for s differ (in checked out version)
@@ -404,11 +382,11 @@
   $ cd ..
 
 Sticky repository, update --clean
-  $ hg update --clean tip
-  U    $TESTTMP/sub/t/s/alpha
-   U   $TESTTMP/sub/t/s
+  $ hg update --clean tip | grep -v s/externals/other
+  U    *s/alpha (glob)
+   U   *s (glob)
   
-  Fetching external item into '$TESTTMP/sub/t/s/externals'
+  Fetching external item into '*s/externals'* (glob)
   Checked out external at revision 1.
   
   Checked out revision 3.
@@ -422,13 +400,7 @@
 
 Test subrepo already at intended revision:
   $ cd s
-  $ svn update -r 2
-  U    alpha
-  
-  Fetching external item into 'externals'
-  Updated external to revision 1.
-  
-  Updated to revision 2.
+  $ svn update -qr 2
   $ cd ..
   $ hg update 1
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -449,8 +421,8 @@
   A         dir
   A         dir/epsilon.py
   $ svn ci -m 'Add dir/epsilon.py'
-  Adding         src/dir
-  Adding         src/dir/epsilon.py
+  Adding         *dir (glob)
+  Adding         *dir/epsilon.py (glob)
   Transmitting file data .
   Committed revision 6.
   $ cd ../..
@@ -466,22 +438,15 @@
   adding a
   $ hg up 0
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  $ svn up -r6 s
-  A    s/dir
-  A    s/dir/epsilon.py
-  
-  Fetching external item into 's/externals'
-  Updated external to revision 1.
-  
-  Updated to revision 6.
+  $ svn up -qr6 s
   $ hg ci -m updatesub
   committing subrepository s
   created new head
   $ echo pyc > s/dir/epsilon.pyc
   $ hg up 1
-  D    $TESTTMP/rebaserepo/s/dir
+  D    *s/dir (glob)
   
-  Fetching external item into '$TESTTMP/rebaserepo/s/externals'
+  Fetching external item into '*s/externals'* (glob)
   Checked out external at revision 1.
   
   Checked out revision 5.
@@ -510,7 +475,7 @@
 Switching back to the head where we have another path mapped to the
 same subrepo should work if the subrepo is clean.
   $ hg co other
-  A    $TESTTMP/rebaserepo/obstruct/other
+  A    *obstruct/other (glob)
   Checked out revision 1.
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
@@ -523,7 +488,7 @@
 Point to a Subversion branch which has since been deleted and recreated
 First, create that condition in the repository.
 
-  $ hg ci --subrepos -m cleanup
+  $ hg ci --subrepos -m cleanup | grep -v Updating
   committing subrepository obstruct
   Sending        obstruct/other
   Transmitting file data .
@@ -550,9 +515,7 @@
   $ svn copy -m "recreate branch" $SVNREPO/trunk $SVNREPO/branch
   
   Committed revision 12.
-  $ svn up
-  D    somethingold
-  Updated to revision 12.
+  $ svn up -q
   $ echo "something new" > somethingnew
   $ svn add somethingnew
   A         somethingnew
@@ -569,16 +532,13 @@
   $ hg ci -m addsub
   committing subrepository recreated
   $ cd recreated
-  $ svn up
-  D    somethingold
-  A    somethingnew
-  Updated to revision 13.
+  $ svn up -q
   $ cd ..
   $ hg ci -m updatesub
   committing subrepository recreated
   $ hg up -r-2
-  D    $TESTTMP/rebaserepo/recreated/somethingnew
-  A    $TESTTMP/rebaserepo/recreated/somethingold
+  D    *recreated/somethingnew (glob)
+  A    *recreated/somethingold (glob)
   Checked out revision 10.
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ test -f recreated/somethingold
--- a/tests/test-url.py	Fri Dec 02 18:36:32 2011 +0100
+++ b/tests/test-url.py	Mon Dec 05 17:48:40 2011 -0600
@@ -219,7 +219,7 @@
     >>> u
     <url scheme: 'file', path: 'f:oo/bar/baz'>
     >>> str(u)
-    'file:f:oo/bar/baz'
+    'file:///f:oo/bar/baz'
     >>> u.localpath()
     'f:oo/bar/baz'