diff --git a/hgext/shelve.py b/hgext/shelve.py --- a/hgext/shelve.py +++ b/hgext/shelve.py @@ -558,7 +558,7 @@ def unshelve(ui, repo, *shelved, **opts) 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] diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -837,10 +837,12 @@ def bookmark(ui, repo, *names, **opts): 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 diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -313,6 +313,18 @@ def _abssource(repo, push=False, abort=T 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 @@ class svnsubrepo(abstractsubrepo): # 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 @@ class gitsubrepo(abstractsubrepo): 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 @@ class gitsubrepo(abstractsubrepo): 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: diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -1634,6 +1634,8 @@ class url(object): >>> url(r'\\blah\blah\blah#baz') + >>> url(r'file:///C:\users\me') + Authentication credentials: @@ -1651,7 +1653,7 @@ class url(object): """ _safechars = "!~*'()+" - _safepchars = "/!~*'()+:" + _safepchars = "/!~*'()+:\\" _matchscheme = re.compile(r'^[a-zA-Z0-9+.\-]+:').match def __init__(self, path, parsequery=True, parsefragment=True): @@ -1788,6 +1790,8 @@ class url(object): '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 diff --git a/tests/test-subrepo-git.t b/tests/test-subrepo-git.t --- a/tests/test-subrepo-git.t +++ b/tests/test-subrepo-git.t @@ -71,7 +71,7 @@ make $GITROOT pushable, by replacing it 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 @@ update to previous substate 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, make local change 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 upstream git changes 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 @@ create nested repo $ 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 @@ relative source expansion $ 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 @@ Don't crash if the subrepo is missing $ 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 diff --git a/tests/test-update-branches.t b/tests/test-update-branches.t --- a/tests/test-update-branches.t +++ b/tests/test-update-branches.t @@ -206,6 +206,7 @@ Test no-argument update to a successor o |/ o 0:60829823a42a 0 + $ hg book bm -r 3 $ hg status M foo @@ -218,10 +219,16 @@ We add simple obsolescence marker betwee $ 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