# HG changeset patch # User Matt Mackall # Date 2015-06-04 22:51:19 # Node ID d0c7ffc4c8bc2513dcb93b1c1244c00527d26a79 # Parent 69609f43c752b53deb8853370401cf29e6e6d99a # Parent 5f3666da691005d8f2c8afe9d2c249ee80fa96ed merge with stable diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -5138,7 +5138,13 @@ def pull(ui, repo, source="default", **o # When 'rev' is a bookmark name, we cannot guarantee that it # will be updated with that name because of a race condition # server side. (See issue 4689 for details) - revs = [other.lookup(rev) for rev in revs] + oldrevs = revs + revs = [] # actually, nodes + for r in oldrevs: + node = other.lookup(r) + revs.append(node) + if r == checkout: + checkout = node except error.CapabilityError: err = _("other repository doesn't support revision lookup, " "so a rev cannot be specified.") @@ -5148,7 +5154,7 @@ def pull(ui, repo, source="default", **o force=opts.get('force'), bookmarks=opts.get('bookmark', ())).cgresult if checkout: - checkout = str(repo.changelog.rev(other.lookup(checkout))) + checkout = str(repo.changelog.rev(checkout)) repo._subtoppath = source try: ret = postincoming(ui, repo, modheads, opts.get('update'), checkout) diff --git a/mercurial/hgweb/hgwebdir_mod.py b/mercurial/hgweb/hgwebdir_mod.py --- a/mercurial/hgweb/hgwebdir_mod.py +++ b/mercurial/hgweb/hgwebdir_mod.py @@ -291,6 +291,12 @@ class hgwebdir(object): # remove name parts plus accompanying slash path = path[:-len(discarded) - 1] + try: + r = hg.repository(self.ui, path) + directory = False + except (IOError, error.RepoError): + pass + parts = [name] if 'PATH_INFO' in req.env: parts.insert(0, req.env['PATH_INFO'].rstrip('/')) diff --git a/tests/test-hgwebdir.t b/tests/test-hgwebdir.t --- a/tests/test-hgwebdir.t +++ b/tests/test-hgwebdir.t @@ -944,6 +944,25 @@ Test collapse = True Test intermediate directories +Hide the subrepo parent + + $ cp $root/notrepo/f/.hg/hgrc $root/notrepo/f/.hg/hgrc.bak + $ cat >> $root/notrepo/f/.hg/hgrc << EOF + > [web] + > hidden = True + > EOF + + $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 'rcoll/notrepo/?style=raw' + 200 Script output follows + + + /rcoll/notrepo/e/ + /rcoll/notrepo/e/e2/ + + +Subrepo parent not hidden + $ mv $root/notrepo/f/.hg/hgrc.bak $root/notrepo/f/.hg/hgrc + $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 'rcoll/notrepo/?style=raw' 200 Script output follows diff --git a/tests/test-pull-r.t b/tests/test-pull-r.t --- a/tests/test-pull-r.t +++ b/tests/test-pull-r.t @@ -101,4 +101,44 @@ This used to abort: received changelog g $ hg pull -qr 1 ../repo +Test race condition with -r and -U (issue4707) + +We pull '-U -r ' and the name change right after/during the changegroup emission. +We use http because http is better is our racy-est option. + + + $ echo babar > ../repo/jungle + $ cat < ../repo/.hg/hgrc + > [hooks] + > outgoing.makecommit = hg ci -Am 'racy commit'; echo committed in pull-race + > EOF + $ hg -R ../repo serve -p $HGPORT2 -d --pid-file=../repo.pid + $ cat ../repo.pid >> $DAEMON_PIDS + $ hg pull --rev default --update http://localhost:$HGPORT2/ + pulling from http://localhost:$HGPORT2/ + searching for changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files (+1 heads) + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg log -G + @ changeset: 2:effea6de0384 + | tag: tip + | parent: 0:bbd179dfa0a7 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: add bar + | + | o changeset: 1:ed1b79f46b9a + |/ user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: change foo + | + o changeset: 0:bbd179dfa0a7 + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: add foo + + $ cd ..