changeset 20108:af12f58e2aa0

merge with stable
author Matt Mackall <mpm@selenic.com>
date Mon, 25 Nov 2013 16:15:44 -0600
parents 04eaa8eec6a0 (current diff) 2ca325ea57fa (diff)
children 40b7c6e4b993
files mercurial/commands.py mercurial/subrepo.py mercurial/util.py
diffstat 6 files changed, 39 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/shelve.py	Mon Nov 18 09:09:05 2013 -0800
+++ b/hgext/shelve.py	Mon Nov 25 16:15:44 2013 -0600
@@ -558,7 +558,7 @@
             oldquiet = ui.quiet
             try:
                 ui.quiet = True
-                node = cmdutil.commit(ui, repo, commitfunc, None, tempopts)
+                node = cmdutil.commit(ui, repo, commitfunc, [], tempopts)
             finally:
                 ui.quiet = oldquiet
             tmpwctx = repo[node]
--- a/mercurial/commands.py	Mon Nov 18 09:09:05 2013 -0800
+++ b/mercurial/commands.py	Mon Nov 25 16:15:44 2013 -0600
@@ -837,10 +837,12 @@
                     bookmarks.deletedivergent(repo, [target], mark)
                     return
 
+                # consider successor changesets as well
+                foreground = obsolete.foreground(repo, [marks[mark]])
                 deletefrom = [b for b in divs
                               if repo[b].rev() in anc or b == target]
                 bookmarks.deletedivergent(repo, deletefrom, mark)
-                if bmctx.rev() in anc:
+                if bmctx.rev() in anc or target in foreground:
                     ui.status(_("moving bookmark '%s' forward from %s\n") %
                               (mark, short(bmctx.node())))
                     return
--- a/mercurial/subrepo.py	Mon Nov 18 09:09:05 2013 -0800
+++ b/mercurial/subrepo.py	Mon Nov 25 16:15:44 2013 -0600
@@ -313,6 +313,18 @@
     if abort:
         raise util.Abort(_("default path for subrepository not found"))
 
+def _sanitize(ui, path):
+    def v(arg, dirname, names):
+        if os.path.basename(dirname).lower() != '.hg':
+            return
+        for f in names:
+            if f.lower() == 'hgrc':
+                ui.warn(
+                    _("warning: removing potentially hostile .hg/hgrc in '%s'"
+                      % path))
+                os.unlink(os.path.join(dirname, f))
+    os.walk(path, v, None)
+
 def itersubrepos(ctx1, ctx2):
     """find subrepos in ctx1 or ctx2"""
     # Create a (subpath, ctx) mapping where we prefer subpaths from
@@ -989,6 +1001,7 @@
         # update to a directory which has since been deleted and recreated.
         args.append('%s@%s' % (state[0], state[1]))
         status, err = self._svncommand(args, failok=True)
+        _sanitize(self._ui, self._path)
         if not re.search('Checked out revision [0-9]+.', status):
             if ('is already a working copy for a different URL' in err
                 and (self._wcchanged()[:2] == (False, False))):
@@ -1249,6 +1262,7 @@
                 self._gitcommand(['reset', 'HEAD'])
                 cmd.append('-f')
             self._gitcommand(cmd + args)
+            _sanitize(self._ui, self._path)
 
         def rawcheckout():
             # no branch to checkout, check it out with no branch
@@ -1332,6 +1346,7 @@
                 self.get(state) # fast forward merge
             elif base != self._state[1]:
                 self._gitcommand(['merge', '--no-commit', revision])
+            _sanitize(self._ui, self._path)
 
         if self.dirty():
             if self._gitstate() != revision:
--- a/mercurial/util.py	Mon Nov 18 09:09:05 2013 -0800
+++ b/mercurial/util.py	Mon Nov 25 16:15:44 2013 -0600
@@ -1634,6 +1634,8 @@
     <url path: '\\\\blah\\blah\\blah'>
     >>> url(r'\\blah\blah\blah#baz')
     <url path: '\\\\blah\\blah\\blah', fragment: 'baz'>
+    >>> url(r'file:///C:\users\me')
+    <url scheme: 'file', path: 'C:\\users\\me'>
 
     Authentication credentials:
 
@@ -1651,7 +1653,7 @@
     """
 
     _safechars = "!~*'()+"
-    _safepchars = "/!~*'()+:"
+    _safepchars = "/!~*'()+:\\"
     _matchscheme = re.compile(r'^[a-zA-Z0-9+.\-]+:').match
 
     def __init__(self, path, parsequery=True, parsefragment=True):
@@ -1788,6 +1790,8 @@
         'file:///c:/tmp/foo/bar'
         >>> print url(r'bundle:foo\bar')
         bundle:foo\bar
+        >>> print url(r'file:///D:\data\hg')
+        file:///D:\data\hg
         """
         if self._localpath:
             s = self.path
--- a/tests/test-subrepo-git.t	Mon Nov 18 09:09:05 2013 -0800
+++ b/tests/test-subrepo-git.t	Mon Nov 25 16:15:44 2013 -0600
@@ -71,7 +71,7 @@
 clone root
 
   $ cd t
-  $ hg clone . ../tc
+  $ hg clone . ../tc 2> /dev/null
   updating to branch default
   cloning subrepo s from $TESTTMP/gitroot
   3 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -94,7 +94,7 @@
 clone root, make local change
 
   $ cd ../t
-  $ hg clone . ../ta
+  $ hg clone . ../ta 2> /dev/null
   updating to branch default
   cloning subrepo s from $TESTTMP/gitroot
   3 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -113,7 +113,7 @@
 clone root separately, make different local change
 
   $ cd ../t
-  $ hg clone . ../tb
+  $ hg clone . ../tb 2> /dev/null
   updating to branch default
   cloning subrepo s from $TESTTMP/gitroot
   3 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -199,7 +199,7 @@
 make and push changes to hg without updating the subrepo
 
   $ cd ../t
-  $ hg clone . ../td
+  $ hg clone . ../td 2>&1 | egrep -v '^Cloning into|^done\.'
   updating to branch default
   cloning subrepo s from $TESTTMP/gitroot
   checking out detached HEAD in subrepo s
@@ -317,7 +317,7 @@
   $ hg add b
   $ hg commit -m b
 
-  $ hg clone ../t inner
+  $ hg clone ../t inner 2> /dev/null
   updating to branch default
   cloning subrepo s from $TESTTMP/gitroot
   3 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -345,7 +345,7 @@
 
   $ cd ..
   $ mkdir d
-  $ hg clone t d/t
+  $ hg clone t d/t 2> /dev/null
   updating to branch default
   cloning subrepo s from $TESTTMP/gitroot
   3 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -364,7 +364,7 @@
   $ hg commit --subrepos -qm missing
   abort: subrepo s is missing (in subrepo s)
   [255]
-  $ hg update -C
+  $ hg update -C 2> /dev/null
   cloning subrepo s from $TESTTMP/gitroot
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg sum | grep commit
--- a/tests/test-update-branches.t	Mon Nov 18 09:09:05 2013 -0800
+++ b/tests/test-update-branches.t	Mon Nov 25 16:15:44 2013 -0600
@@ -206,6 +206,7 @@
   |/
   o  0:60829823a42a 0
   
+  $ hg book bm -r 3
   $ hg status
   M foo
 
@@ -218,10 +219,16 @@
   $ hg debugobsolete 6efa171f091b00a3c35edc15d48c52a498929953 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
   $ hg debugobsolete aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa d047485b3896813b2a624e86201983520f003206
 
-Test that 5 is detected as a valid destination from 3
+Test that 5 is detected as a valid destination from 3 and also accepts moving
+the bookmark (issue4015)
+
   $ hg up --quiet --hidden 3
   $ hg up 5
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg book bm
+  moving bookmark 'bm' forward from 6efa171f091b
+  $ hg bookmarks
+   * bm                        5:ff252e8273df
 
 Test that 5 is detected as a valid destination from 1
   $ hg up --quiet 0          # we should be able to update to 3 directly