merge with stable
authorMatt Mackall <mpm@selenic.com>
Thu, 04 Jun 2015 17:51:19 -0500
changeset 25427 d0c7ffc4c8bc
parent 25424 69609f43c752 (current diff)
parent 25426 5f3666da6910 (diff)
child 25428 51e7acc34b0a
merge with stable
mercurial/commands.py
mercurial/hgweb/hgwebdir_mod.py
--- a/mercurial/commands.py	Fri May 29 13:11:52 2015 -0700
+++ b/mercurial/commands.py	Thu Jun 04 17:51:19 2015 -0500
@@ -5138,7 +5138,13 @@
                 # 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 @@
                                  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)
--- a/mercurial/hgweb/hgwebdir_mod.py	Fri May 29 13:11:52 2015 -0700
+++ b/mercurial/hgweb/hgwebdir_mod.py	Thu Jun 04 17:51:19 2015 -0500
@@ -291,6 +291,12 @@
                         # 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('/'))
--- a/tests/test-hgwebdir.t	Fri May 29 13:11:52 2015 -0700
+++ b/tests/test-hgwebdir.t	Thu Jun 04 17:51:19 2015 -0500
@@ -944,6 +944,25 @@
 
 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
   
--- a/tests/test-pull-r.t	Fri May 29 13:11:52 2015 -0700
+++ b/tests/test-pull-r.t	Thu Jun 04 17:51:19 2015 -0500
@@ -101,4 +101,44 @@
 
   $ hg pull -qr 1 ../repo
 
+Test race condition with -r and -U (issue4707)
+
+We pull '-U -r <name>' 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 <<EOF > ../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 ..