# HG changeset patch # User Matt Mackall # Date 1401656308 25200 # Node ID 269c80ee5b3cb3684fa8edc61501b3506d02eb10 # Parent 99ba1d082287e5d701c86dfea7e7a5f9adc9dad4# Parent b6cd12d6822d9e853b80517bf61ec2b53f131fa9 merge with i18n diff -r b6cd12d6822d -r 269c80ee5b3c hgext/bugzilla.py --- a/hgext/bugzilla.py Fri May 30 19:52:55 2014 +0900 +++ b/hgext/bugzilla.py Sun Jun 01 13:58:28 2014 -0700 @@ -1,7 +1,7 @@ # bugzilla.py - bugzilla integration for mercurial # # Copyright 2006 Vadim Gelfer -# Copyright 2011-2 Jim Hague +# Copyright 2011-4 Jim Hague # # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. @@ -523,7 +523,7 @@ The regular xmlrpclib transports ignore cookies. Which causes a bit of a problem when you need a cookie-based login, as with - the Bugzilla XMLRPC interface. + the Bugzilla XMLRPC interface prior to 4.4.3. So this is a helper for defining a Transport which looks for cookies being set in responses and saves them to add to all future @@ -620,7 +620,9 @@ ver = self.bzproxy.Bugzilla.version()['version'].split('.') self.bzvermajor = int(ver[0]) self.bzverminor = int(ver[1]) - self.bzproxy.User.login({'login': user, 'password': passwd}) + login = self.bzproxy.User.login({'login': user, 'password': passwd, + 'restrict_login': True}) + self.bztoken = login.get('token', '') def transport(self, uri): if urlparse.urlparse(uri, "http")[0] == "https": @@ -631,13 +633,15 @@ def get_bug_comments(self, id): """Return a string with all comment text for a bug.""" c = self.bzproxy.Bug.comments({'ids': [id], - 'include_fields': ['text']}) + 'include_fields': ['text'], + 'token': self.bztoken}) return ''.join([t['text'] for t in c['bugs'][str(id)]['comments']]) def filter_real_bug_ids(self, bugs): probe = self.bzproxy.Bug.get({'ids': sorted(bugs.keys()), 'include_fields': [], 'permissive': True, + 'token': self.bztoken, }) for badbug in probe['faults']: id = badbug['id'] @@ -662,6 +666,7 @@ if 'fix' in newstate: args['status'] = self.fixstatus args['resolution'] = self.fixresolution + args['token'] = self.bztoken self.bzproxy.Bug.update(args) else: if 'fix' in newstate: @@ -719,10 +724,12 @@ than the subject line, and leave a blank line after it. ''' user = self.map_committer(committer) - matches = self.bzproxy.User.get({'match': [user]}) + matches = self.bzproxy.User.get({'match': [user], + 'token': self.bztoken}) if not matches['users']: user = self.ui.config('bugzilla', 'user', 'bugs') - matches = self.bzproxy.User.get({'match': [user]}) + matches = self.bzproxy.User.get({'match': [user], + 'token': self.bztoken}) if not matches['users']: raise util.Abort(_("default bugzilla user %s email not found") % user) diff -r b6cd12d6822d -r 269c80ee5b3c mercurial/changelog.py --- a/mercurial/changelog.py Fri May 30 19:52:55 2014 +0900 +++ b/mercurial/changelog.py Sun Jun 01 13:58:28 2014 -0700 @@ -127,6 +127,7 @@ self._generaldelta = False self._realopener = opener self._delayed = False + self._delaybuf = [] self._divert = False self.filteredrevs = frozenset() diff -r b6cd12d6822d -r 269c80ee5b3c mercurial/commands.py --- a/mercurial/commands.py Fri May 30 19:52:55 2014 +0900 +++ b/mercurial/commands.py Sun Jun 01 13:58:28 2014 -0700 @@ -951,8 +951,9 @@ if ui.quiet: ui.write("%s\n" % bmark, label=label) else: - ui.write(" %s %-25s %d:%s\n" % ( - prefix, bmark, repo.changelog.rev(n), hexfn(n)), + pad = " " * (25 - encoding.colwidth(bmark)) + ui.write(" %s %s%s %d:%s\n" % ( + prefix, bmark, pad, repo.changelog.rev(n), hexfn(n)), label=label) @command('branch', diff -r b6cd12d6822d -r 269c80ee5b3c mercurial/dispatch.py --- a/mercurial/dispatch.py Fri May 30 19:52:55 2014 +0900 +++ b/mercurial/dispatch.py Sun Jun 01 13:58:28 2014 -0700 @@ -355,7 +355,7 @@ if not self.definition: def fn(ui, *args): ui.warn(_("no definition for alias '%s'\n") % self.name) - return 1 + return -1 self.fn = fn self.badalias = True return @@ -383,7 +383,16 @@ self.fn = fn return - args = shlex.split(self.definition) + try: + args = shlex.split(self.definition) + except ValueError, inst: + def fn(ui, *args): + ui.warn(_("error in definition for alias '%s': %s\n") + % (self.name, inst)) + return -1 + self.fn = fn + self.badalias = True + return self.cmdname = cmd = args.pop(0) args = map(util.expandpath, args) @@ -393,7 +402,7 @@ ui.warn(_("error in definition for alias '%s': %s may only " "be given on the command line\n") % (self.name, invalidarg)) - return 1 + return -1 self.fn = fn self.badalias = True @@ -425,14 +434,14 @@ commands.help_(ui, cmd, unknowncmd=True) except error.UnknownCommand: pass - return 1 + return -1 self.fn = fn self.badalias = True except error.AmbiguousCommand: def fn(ui, *args): ui.warn(_("alias '%s' resolves to ambiguous command '%s'\n") \ % (self.name, cmd)) - return 1 + return -1 self.fn = fn self.badalias = True @@ -445,7 +454,7 @@ return self.fn(ui, *args, **opts) else: try: - util.checksignature(self.fn)(ui, *args, **opts) + return util.checksignature(self.fn)(ui, *args, **opts) except error.SignatureError: args = ' '.join([self.cmdname] + self.args) ui.debug("alias '%s' expands to '%s'\n" % (self.name, args)) diff -r b6cd12d6822d -r 269c80ee5b3c mercurial/exchange.py --- a/mercurial/exchange.py Fri May 30 19:52:55 2014 +0900 +++ b/mercurial/exchange.py Sun Jun 01 13:58:28 2014 -0700 @@ -537,7 +537,7 @@ lock = pullop.repo.lock() try: _pulldiscovery(pullop) - if (pullop.repo.ui.configbool('server', 'bundle2', False) + if (pullop.repo.ui.configbool('experimental', 'bundle2-exp', False) and pullop.remote.capable('bundle2-exp')): _pullbundle2(pullop) if 'changegroup' in pullop.todosteps: @@ -573,12 +573,13 @@ kwargs['bundlecaps'].add('bundle2=' + urllib.quote(capsblob)) # pulling changegroup pullop.todosteps.remove('changegroup') + + kwargs['common'] = pullop.common + kwargs['heads'] = pullop.heads or pullop.rheads if not pullop.fetch: - pullop.repo.ui.status(_("no changes found\n")) - pullop.cgresult = 0 + pullop.repo.ui.status(_("no changes found\n")) + pullop.cgresult = 0 else: - kwargs['common'] = pullop.common - kwargs['heads'] = pullop.heads or pullop.rheads if pullop.heads is None and list(pullop.common) == [nullid]: pullop.repo.ui.status(_("requesting all changes\n")) _pullbundle2extraprepare(pullop, kwargs) @@ -589,8 +590,10 @@ op = bundle2.processbundle(pullop.repo, bundle, pullop.gettransaction) except bundle2.UnknownPartError, exc: raise util.Abort('missing support for %s' % exc) - assert len(op.records['changegroup']) == 1 - pullop.cgresult = op.records['changegroup'][0]['return'] + + if pullop.fetch: + assert len(op.records['changegroup']) == 1 + pullop.cgresult = op.records['changegroup'][0]['return'] def _pullbundle2extraprepare(pullop, kwargs): """hook function so that extensions can extend the getbundle call""" @@ -684,7 +687,7 @@ The implementation is at a very early stage and will get massive rework when the API of bundle is refined. """ - # build bundle here. + # build changegroup bundle here. cg = changegroup.getbundle(repo, source, heads=heads, common=common, bundlecaps=bundlecaps) if bundlecaps is None or 'HG2X' not in bundlecaps: @@ -697,10 +700,11 @@ blob = urllib.unquote(bcaps[len('bundle2='):]) b2caps.update(bundle2.decodecaps(blob)) bundler = bundle2.bundle20(repo.ui, b2caps) - part = bundle2.bundlepart('b2x:changegroup', data=cg.getchunks()) - bundler.addpart(part) - _getbundleextrapart(bundler, repo, source, heads=None, common=None, - bundlecaps=None, **kwargs) + if cg: + part = bundle2.bundlepart('b2x:changegroup', data=cg.getchunks()) + bundler.addpart(part) + _getbundleextrapart(bundler, repo, source, heads=heads, common=common, + bundlecaps=bundlecaps, **kwargs) return util.chunkbuffer(bundler.getchunks()) def _getbundleextrapart(bundler, repo, source, heads=None, common=None, diff -r b6cd12d6822d -r 269c80ee5b3c mercurial/localrepo.py --- a/mercurial/localrepo.py Fri May 30 19:52:55 2014 +0900 +++ b/mercurial/localrepo.py Sun Jun 01 13:58:28 2014 -0700 @@ -858,7 +858,7 @@ _("abandoned transaction found - run hg recover")) def onclose(): - self.store.write(tr) + self.store.write(self._transref()) self._writejournal(desc) renames = [(vfs, x, undoname(x)) for vfs, x in self._journalfiles()] diff -r b6cd12d6822d -r 269c80ee5b3c mercurial/pathutil.py --- a/mercurial/pathutil.py Fri May 30 19:52:55 2014 +0900 +++ b/mercurial/pathutil.py Sun Jun 01 13:58:28 2014 -0700 @@ -142,3 +142,25 @@ name = dirname raise util.Abort(_("%s not under root '%s'") % (myname, root)) + +def normasprefix(path): + '''normalize the specified path as path prefix + + Returned vaule can be used safely for "p.startswith(prefix)", + "p[len(prefix):]", and so on. + + For efficiency, this expects "path" argument to be already + normalized by "os.path.normpath", "os.path.realpath", and so on. + + See also issue3033 for detail about need of this function. + + >>> normasprefix('/foo/bar').replace(os.sep, '/') + '/foo/bar/' + >>> normasprefix('/').replace(os.sep, '/') + '/' + ''' + d, p = os.path.splitdrive(path) + if len(p) != len(os.sep): + return path + os.sep + else: + return path diff -r b6cd12d6822d -r 269c80ee5b3c mercurial/subrepo.py --- a/mercurial/subrepo.py Fri May 30 19:52:55 2014 +0900 +++ b/mercurial/subrepo.py Sun Jun 01 13:58:28 2014 -0700 @@ -276,8 +276,7 @@ parent = repo while util.safehasattr(parent, '_subparent'): parent = parent._subparent - p = parent.root.rstrip(os.sep) - return repo.root[len(p) + 1:] + return repo.root[len(pathutil.normasprefix(parent.root)):] def subrelpath(sub): """return path to this subrepo as seen from outermost repo""" @@ -314,17 +313,19 @@ if abort: raise util.Abort(_("default path for subrepository not found")) -def _sanitize(ui, path): - def v(arg, dirname, names): +def _sanitize(ui, path, ignore): + for dirname, dirs, names in os.walk(path): + for i, d in enumerate(dirs): + if d.lower() == ignore: + del dirs[i] + break if os.path.basename(dirname).lower() != '.hg': - return + continue for f in names: if f.lower() == 'hgrc': - ui.warn( - _("warning: removing potentially hostile .hg/hgrc in '%s'") - % path) + ui.warn(_("warning: removing potentially hostile 'hgrc' " + "in '%s'\n") % dirname) os.unlink(os.path.join(dirname, f)) - os.walk(path, v, None) def subrepo(ctx, path): """return instance of the right subrepo class for subrepo in path""" @@ -1052,7 +1053,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) + _sanitize(self._ui, self._ctx._repo.wjoin(self._path), '.svn') 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))): @@ -1345,7 +1346,7 @@ self._gitcommand(['reset', 'HEAD']) cmd.append('-f') self._gitcommand(cmd + args) - _sanitize(self._ui, self._path) + _sanitize(self._ui, self._abspath, '.git') def rawcheckout(): # no branch to checkout, check it out with no branch @@ -1394,6 +1395,7 @@ if tracking[remote] != self._gitcurrentbranch(): checkout([tracking[remote]]) self._gitcommand(['merge', '--ff', remote]) + _sanitize(self._ui, self._abspath, '.git') else: # a real merge would be required, just checkout the revision rawcheckout() @@ -1429,7 +1431,7 @@ self.get(state) # fast forward merge elif base != self._state[1]: self._gitcommand(['merge', '--no-commit', revision]) - _sanitize(self._ui, self._path) + _sanitize(self._ui, self._abspath, '.git') if self.dirty(): if self._gitstate() != revision: diff -r b6cd12d6822d -r 269c80ee5b3c mercurial/templater.py --- a/mercurial/templater.py Fri May 30 19:52:55 2014 +0900 +++ b/mercurial/templater.py Sun Jun 01 13:58:28 2014 -0700 @@ -310,7 +310,9 @@ item = stringify(args[0][0](context, mapping, args[0][1])) items = args[1][0](context, mapping, args[1][1]) - if item in items: + # Iterating over items gives a formatted string, so we iterate + # directly over the raw values. + if item in [i.values()[0] for i in items()]: yield _evalifliteral(args[2], context, mapping) elif len(args) == 4: yield _evalifliteral(args[3], context, mapping) diff -r b6cd12d6822d -r 269c80ee5b3c mercurial/url.py --- a/mercurial/url.py Fri May 30 19:52:55 2014 +0900 +++ b/mercurial/url.py Sun Jun 01 13:58:28 2014 -0700 @@ -225,7 +225,6 @@ proxyheaders = dict( [(x, self.headers[x]) for x in self.headers if x.lower().startswith('proxy-')]) - self._set_hostport(self.host, self.port) self.send('CONNECT %s HTTP/1.0\r\n' % self.realhostport) for header in proxyheaders.iteritems(): self.send('%s: %s\r\n' % header) diff -r b6cd12d6822d -r 269c80ee5b3c mercurial/wireproto.py --- a/mercurial/wireproto.py Fri May 30 19:52:55 2014 +0900 +++ b/mercurial/wireproto.py Sun Jun 01 13:58:28 2014 -0700 @@ -619,9 +619,15 @@ opts = options('debugwireargs', ['three', 'four'], others) return repo.debugwireargs(one, two, **opts) +# List of options accepted by getbundle. +# +# Meant to be extended by extensions. It is the extension's responsibility to +# ensure such options are properly processed in exchange.getbundle. +gboptslist = ['heads', 'common', 'bundlecaps'] + @wireprotocommand('getbundle', '*') def getbundle(repo, proto, others): - opts = options('getbundle', ['heads', 'common', 'bundlecaps'], others) + opts = options('getbundle', gboptslist, others) for k, v in opts.iteritems(): if k in ('heads', 'common'): opts[k] = decodelist(v) diff -r b6cd12d6822d -r 269c80ee5b3c tests/test-alias.t --- a/tests/test-alias.t Fri May 30 19:52:55 2014 +0900 +++ b/tests/test-alias.t Sun Jun 01 13:58:28 2014 -0700 @@ -4,12 +4,14 @@ > # should clobber ci but not commit (issue2993) > ci = version > myinit = init + > mycommit = commit > optionalrepo = showconfig alias.myinit > cleanstatus = status -c > unknown = bargle > ambiguous = s > recursive = recursive > nodefinition = + > noclosingquotation = ' > no--cwd = status --cwd elsewhere > no-R = status -R elsewhere > no--repo = status --repo elsewhere @@ -41,6 +43,7 @@ > escaped2 = !sh -c 'echo "HGFOO is \$\$HGFOO"' > escaped3 = !sh -c 'echo "\$1 is \$\$\$1"' > escaped4 = !printf '\$\$0 \$\$@\n' + > exit1 = !sh -c 'exit 1' > > [defaults] > mylog = -q @@ -58,6 +61,7 @@ $ hg unknown alias 'unknown' resolves to unknown command 'bargle' + [255] $ hg help unknown alias 'unknown' resolves to unknown command 'bargle' @@ -66,6 +70,7 @@ $ hg ambiguous alias 'ambiguous' resolves to ambiguous command 's' + [255] $ hg help ambiguous alias 'ambiguous' resolves to ambiguous command 's' @@ -74,6 +79,7 @@ $ hg recursive alias 'recursive' resolves to unknown command 'recursive' + [255] $ hg help recursive alias 'recursive' resolves to unknown command 'recursive' @@ -82,30 +88,45 @@ $ hg nodef no definition for alias 'nodefinition' + [255] $ hg help nodef no definition for alias 'nodefinition' +no closing quotation + + $ hg noclosing + error in definition for alias 'noclosingquotation': No closing quotation + [255] + $ hg help noclosing + error in definition for alias 'noclosingquotation': No closing quotation + + invalid options $ hg no--cwd error in definition for alias 'no--cwd': --cwd may only be given on the command line + [255] $ hg help no--cwd error in definition for alias 'no--cwd': --cwd may only be given on the command line $ hg no-R error in definition for alias 'no-R': -R may only be given on the command line + [255] $ hg help no-R error in definition for alias 'no-R': -R may only be given on the command line $ hg no--repo error in definition for alias 'no--repo': --repo may only be given on the command line + [255] $ hg help no--repo error in definition for alias 'no--repo': --repo may only be given on the command line $ hg no--repository error in definition for alias 'no--repository': --repository may only be given on the command line + [255] $ hg help no--repository error in definition for alias 'no--repository': --repository may only be given on the command line $ hg no--config error in definition for alias 'no--config': --config may only be given on the command line + [255] optional repository @@ -125,6 +146,7 @@ $ hg nousage no rollback information available + [1] $ echo foo > foo $ hg commit -Amfoo @@ -442,3 +464,11 @@ $ hg --config alias.log='id' history $ cd ../.. + +return code of command and shell aliases: + + $ hg mycommit -R alias + nothing changed + [1] + $ hg exit1 + [1] diff -r b6cd12d6822d -r 269c80ee5b3c tests/test-bundle2.t --- a/tests/test-bundle2.t Fri May 30 19:52:55 2014 +0900 +++ b/tests/test-bundle2.t Sun Jun 01 13:58:28 2014 -0700 @@ -8,6 +8,14 @@ > code. We still need to be able to test it while it grow up. > """ > + > try: + > import msvcrt + > msvcrt.setmode(sys.stdin.fileno(), os.O_BINARY) + > msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY) + > msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY) + > except ImportError: + > pass + > > import sys > from mercurial import cmdutil > from mercurial import util @@ -791,6 +799,12 @@ added 1 changesets with 1 changes to 1 files (+1 heads) (run 'hg heads' to see heads, 'hg merge' to merge) +pull empty + + $ hg -R other pull -r 24b6387c8c8c + pulling from $TESTTMP/main (glob) + no changes found + push $ hg -R main push other --rev eea13746799a diff -r b6cd12d6822d -r 269c80ee5b3c tests/test-command-template.t --- a/tests/test-command-template.t Fri May 30 19:52:55 2014 +0900 +++ b/tests/test-command-template.t Sun Jun 01 13:58:28 2014 -0700 @@ -1819,6 +1819,11 @@ 1 not current rev 0 not current rev + $ hg log --template '{rev} {ifcontains(rev, revset(". + .^"), "match rev", "not match rev")}\n' + 2 match rev + 1 match rev + 0 not match rev + $ hg log --template '{rev} Parents: {revset("parents(%s)", rev)}\n' 2 Parents: 1 1 Parents: 0 diff -r b6cd12d6822d -r 269c80ee5b3c tests/test-doctest.py --- a/tests/test-doctest.py Fri May 30 19:52:55 2014 +0900 +++ b/tests/test-doctest.py Sun Jun 01 13:58:28 2014 -0700 @@ -19,6 +19,7 @@ testmod('mercurial.hgweb.hgwebdir_mod') testmod('mercurial.match') testmod('mercurial.minirst') +testmod('mercurial.pathutil') testmod('mercurial.revset') testmod('mercurial.store') testmod('mercurial.subrepo') diff -r b6cd12d6822d -r 269c80ee5b3c tests/test-encoding-align.t --- a/tests/test-encoding-align.t Fri May 30 19:52:55 2014 +0900 +++ b/tests/test-encoding-align.t Sun Jun 01 13:58:28 2014 -0700 @@ -117,22 +117,25 @@ marked working directory as branch \xe7\x9f\xad\xe5\x90\x8d (esc) (branches are permanent and global, did you want a bookmark?) $ hg tag $S + $ hg book -f $S $ hg branch $M marked working directory as branch MIDDLE_ (branches are permanent and global, did you want a bookmark?) $ hg tag $M + $ hg book -f $M $ hg branch $L marked working directory as branch \xe9\x95\xb7\xe3\x81\x84\xe9\x95\xb7\xe3\x81\x84\xe5\x90\x8d\xe5\x89\x8d (esc) (branches are permanent and global, did you want a bookmark?) $ hg tag $L + $ hg book -f $L check alignment of branches - $ hg tags - tip 5:d745ff46155b - \xe9\x95\xb7\xe3\x81\x84\xe9\x95\xb7\xe3\x81\x84\xe5\x90\x8d\xe5\x89\x8d 4:9259be597f19 (esc) - MIDDLE_ 3:b06c5b6def9e - \xe7\x9f\xad\xe5\x90\x8d 2:64a70663cee8 (esc) + $ hg branches + \xe9\x95\xb7\xe3\x81\x84\xe9\x95\xb7\xe3\x81\x84\xe5\x90\x8d\xe5\x89\x8d 5:d745ff46155b (esc) + MIDDLE_ 4:9259be597f19 (inactive) + \xe7\x9f\xad\xe5\x90\x8d 3:b06c5b6def9e (inactive) (esc) + default 2:64a70663cee8 (inactive) check alignment of tags @@ -142,4 +145,9 @@ MIDDLE_ 3:b06c5b6def9e \xe7\x9f\xad\xe5\x90\x8d 2:64a70663cee8 (esc) - $ cd .. +check alignment of bookmarks + + $ hg book + MIDDLE_ 5:d745ff46155b + \xe7\x9f\xad\xe5\x90\x8d 4:9259be597f19 (esc) + * \xe9\x95\xb7\xe3\x81\x84\xe9\x95\xb7\xe3\x81\x84\xe5\x90\x8d\xe5\x89\x8d 5:d745ff46155b (esc) diff -r b6cd12d6822d -r 269c80ee5b3c tests/test-subrepo-git.t --- a/tests/test-subrepo-git.t Fri May 30 19:52:55 2014 +0900 +++ b/tests/test-subrepo-git.t Sun Jun 01 13:58:28 2014 -0700 @@ -566,3 +566,105 @@ #endif $ cd .. + +Test sanitizing ".hg/hgrc" in subrepo + + $ cd t + $ hg tip -q + 7:af6d2edbb0d3 + $ hg update -q -C af6d2edbb0d3 + $ cd s + $ git checkout -q -b sanitize-test + $ mkdir .hg + $ echo '.hg/hgrc in git repo' > .hg/hgrc + $ mkdir -p sub/.hg + $ echo 'sub/.hg/hgrc in git repo' > sub/.hg/hgrc + $ git add .hg sub + $ git commit -qm 'add .hg/hgrc to be sanitized at hg update' + $ git push -q origin sanitize-test + $ cd .. + $ grep ' s$' .hgsubstate + 32a343883b74769118bb1d3b4b1fbf9156f4dddc s + $ hg commit -qm 'commit with git revision including .hg/hgrc' + $ hg parents -q + 8:3473d20bddcf + $ grep ' s$' .hgsubstate + c4069473b459cf27fd4d7c2f50c4346b4e936599 s + $ cd .. + + $ hg -R tc pull -q + $ hg -R tc update -q -C 3473d20bddcf 2>&1 | sort + warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/.hg' (glob) + warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/sub/.hg' (glob) + $ cd tc + $ hg parents -q + 8:3473d20bddcf + $ grep ' s$' .hgsubstate + c4069473b459cf27fd4d7c2f50c4346b4e936599 s + $ cat s/.hg/hgrc + cat: s/.hg/hgrc: No such file or directory + [1] + $ cat s/sub/.hg/hgrc + cat: s/sub/.hg/hgrc: No such file or directory + [1] + $ cd .. + +additional test for "git merge --ff" route: + + $ cd t + $ hg tip -q + 8:3473d20bddcf + $ hg update -q -C af6d2edbb0d3 + $ cd s + $ git checkout -q testing + $ mkdir .hg + $ echo '.hg/hgrc in git repo' > .hg/hgrc + $ mkdir -p sub/.hg + $ echo 'sub/.hg/hgrc in git repo' > sub/.hg/hgrc + $ git add .hg sub + $ git commit -qm 'add .hg/hgrc to be sanitized at hg update (git merge --ff)' + $ git push -q origin testing + $ cd .. + $ grep ' s$' .hgsubstate + 32a343883b74769118bb1d3b4b1fbf9156f4dddc s + $ hg commit -qm 'commit with git revision including .hg/hgrc' + $ hg parents -q + 9:ed23f7fe024e + $ grep ' s$' .hgsubstate + f262643c1077219fbd3858d54e78ef050ef84fbf s + $ cd .. + + $ cd tc + $ hg update -q -C af6d2edbb0d3 + $ cat s/.hg/hgrc + cat: s/.hg/hgrc: No such file or directory + [1] + $ cat s/sub/.hg/hgrc + cat: s/sub/.hg/hgrc: No such file or directory + [1] + $ cd .. + $ hg -R tc pull -q + $ hg -R tc update -q -C ed23f7fe024e 2>&1 | sort + warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/.hg' (glob) + warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/sub/.hg' (glob) + $ cd tc + $ hg parents -q + 9:ed23f7fe024e + $ grep ' s$' .hgsubstate + f262643c1077219fbd3858d54e78ef050ef84fbf s + $ cat s/.hg/hgrc + cat: s/.hg/hgrc: No such file or directory + [1] + $ cat s/sub/.hg/hgrc + cat: s/sub/.hg/hgrc: No such file or directory + [1] + +Test that sanitizing is omitted in meta data area: + + $ mkdir s/.git/.hg + $ echo '.hg/hgrc in git metadata area' > s/.git/.hg/hgrc + $ hg update -q -C af6d2edbb0d3 + checking out detached HEAD in subrepo s + check out a git branch if you intend to make changes + + $ cd .. diff -r b6cd12d6822d -r 269c80ee5b3c tests/test-subrepo-svn.t --- a/tests/test-subrepo-svn.t Fri May 30 19:52:55 2014 +0900 +++ b/tests/test-subrepo-svn.t Sun Jun 01 13:58:28 2014 -0700 @@ -632,3 +632,54 @@ Checked out revision 15. 2 files updated, 0 files merged, 0 files removed, 0 files unresolved $ cd .. + +Test sanitizing ".hg/hgrc" in subrepo + + $ cd sub/t + $ hg update -q -C tip + $ cd s + $ mkdir .hg + $ echo '.hg/hgrc in svn repo' > .hg/hgrc + $ mkdir -p sub/.hg + $ echo 'sub/.hg/hgrc in svn repo' > sub/.hg/hgrc + $ svn add .hg sub + A .hg + A .hg/hgrc (glob) + A sub + A sub/.hg (glob) + A sub/.hg/hgrc (glob) + $ svn ci -m 'add .hg/hgrc to be sanitized at hg update' + Adding .hg + Adding .hg/hgrc (glob) + Adding sub + Adding sub/.hg (glob) + Adding sub/.hg/hgrc (glob) + Transmitting file data .. + Committed revision 16. + $ svn up -q + $ cd .. + $ hg commit -S -m 'commit with svn revision including .hg/hgrc' + $ grep ' s$' .hgsubstate + 16 s + $ cd .. + + $ hg -R tc pull -u -q 2>&1 | sort + warning: removing potentially hostile 'hgrc' in '$TESTTMP/sub/tc/s/.hg' (glob) + warning: removing potentially hostile 'hgrc' in '$TESTTMP/sub/tc/s/sub/.hg' (glob) + $ cd tc + $ grep ' s$' .hgsubstate + 16 s + $ cat s/.hg/hgrc + cat: s/.hg/hgrc: No such file or directory + [1] + $ cat s/sub/.hg/hgrc + cat: s/sub/.hg/hgrc: No such file or directory + [1] + +Test that sanitizing is omitted in meta data area: + + $ mkdir s/.svn/.hg + $ echo '.hg/hgrc in svn metadata area' > s/.svn/.hg/hgrc + $ hg update -q -C '.^1' + + $ cd ../..