##// END OF EJS Templates
pull: avoid race condition with 'hg pull --rev name --update' (issue4706)...
Pierre-Yves David -
r25425:9263f86b stable
parent child Browse files
Show More
@@ -5112,7 +5112,13 b' def pull(ui, repo, source="default", **o'
5112 5112
5113 5113 if revs:
5114 5114 try:
5115 revs = [other.lookup(rev) for rev in revs]
5115 oldrevs = revs
5116 revs = [] # actually, nodes
5117 for r in oldrevs:
5118 node = other.lookup(r)
5119 revs.append(node)
5120 if r == checkout:
5121 checkout = node
5116 5122 except error.CapabilityError:
5117 5123 err = _("other repository doesn't support revision lookup, "
5118 5124 "so a rev cannot be specified.")
@@ -5122,7 +5128,7 b' def pull(ui, repo, source="default", **o'
5122 5128 force=opts.get('force'),
5123 5129 bookmarks=opts.get('bookmark', ())).cgresult
5124 5130 if checkout:
5125 checkout = str(repo.changelog.rev(other.lookup(checkout)))
5131 checkout = str(repo.changelog.rev(checkout))
5126 5132 repo._subtoppath = source
5127 5133 try:
5128 5134 ret = postincoming(ui, repo, modheads, opts.get('update'), checkout)
@@ -101,4 +101,44 b' This used to abort: received changelog g'
101 101
102 102 $ hg pull -qr 1 ../repo
103 103
104 Test race condition with -r and -U (issue4707)
105
106 We pull '-U -r <name>' and the name change right after/during the changegroup emission.
107 We use http because http is better is our racy-est option.
108
109
110 $ echo babar > ../repo/jungle
111 $ cat <<EOF > ../repo/.hg/hgrc
112 > [hooks]
113 > outgoing.makecommit = hg ci -Am 'racy commit'; echo committed in pull-race
114 > EOF
115 $ hg -R ../repo serve -p $HGPORT2 -d --pid-file=../repo.pid
116 $ cat ../repo.pid >> $DAEMON_PIDS
117 $ hg pull --rev default --update http://localhost:$HGPORT2/
118 pulling from http://localhost:$HGPORT2/
119 searching for changes
120 adding changesets
121 adding manifests
122 adding file changes
123 added 1 changesets with 1 changes to 1 files (+1 heads)
124 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
125 $ hg log -G
126 @ changeset: 2:effea6de0384
127 | tag: tip
128 | parent: 0:bbd179dfa0a7
129 | user: test
130 | date: Thu Jan 01 00:00:00 1970 +0000
131 | summary: add bar
132 |
133 | o changeset: 1:ed1b79f46b9a
134 |/ user: test
135 | date: Thu Jan 01 00:00:00 1970 +0000
136 | summary: change foo
137 |
138 o changeset: 0:bbd179dfa0a7
139 user: test
140 date: Thu Jan 01 00:00:00 1970 +0000
141 summary: add foo
142
143
104 144 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now