##// END OF EJS Templates
pull: list bookmarks before pulling changesets (issue3873)...
Siddharth Agarwal -
r18851:a60963c0 default
parent child Browse files
Show More
@@ -221,9 +221,8 def pushbookmark(repo, key, old, new):
221 finally:
221 finally:
222 w.release()
222 w.release()
223
223
224 def updatefromremote(ui, repo, remote, path):
224 def updatefromremote(ui, repo, remotemarks, path):
225 ui.debug("checking for updated bookmarks\n")
225 ui.debug("checking for updated bookmarks\n")
226 remotemarks = remote.listkeys('bookmarks')
227 changed = False
226 changed = False
228 localmarks = repo._bookmarks
227 localmarks = repo._bookmarks
229 for k in sorted(remotemarks):
228 for k in sorted(remotemarks):
@@ -4496,10 +4496,11 def pull(ui, repo, source="default", **o
4496 ui.status(_('pulling from %s\n') % util.hidepassword(source))
4496 ui.status(_('pulling from %s\n') % util.hidepassword(source))
4497 revs, checkout = hg.addbranchrevs(repo, other, branches, opts.get('rev'))
4497 revs, checkout = hg.addbranchrevs(repo, other, branches, opts.get('rev'))
4498
4498
4499 remotebookmarks = other.listkeys('bookmarks')
4500
4499 if opts.get('bookmark'):
4501 if opts.get('bookmark'):
4500 if not revs:
4502 if not revs:
4501 revs = []
4503 revs = []
4502 remotebookmarks = other.listkeys('bookmarks')
4503 for b in opts['bookmark']:
4504 for b in opts['bookmark']:
4504 if b not in remotebookmarks:
4505 if b not in remotebookmarks:
4505 raise util.Abort(_('remote bookmark %s not found!') % b)
4506 raise util.Abort(_('remote bookmark %s not found!') % b)
@@ -4514,7 +4515,7 def pull(ui, repo, source="default", **o
4514 raise util.Abort(err)
4515 raise util.Abort(err)
4515
4516
4516 modheads = repo.pull(other, heads=revs, force=opts.get('force'))
4517 modheads = repo.pull(other, heads=revs, force=opts.get('force'))
4517 bookmarks.updatefromremote(ui, repo, other, source)
4518 bookmarks.updatefromremote(ui, repo, remotebookmarks, source)
4518 if checkout:
4519 if checkout:
4519 checkout = str(repo.changelog.rev(other.lookup(checkout)))
4520 checkout = str(repo.changelog.rev(other.lookup(checkout)))
4520 repo._subtoppath = source
4521 repo._subtoppath = source
@@ -547,9 +547,10 class hgsubrepo(abstractsubrepo):
547 else:
547 else:
548 self._repo.ui.status(_('pulling subrepo %s from %s\n')
548 self._repo.ui.status(_('pulling subrepo %s from %s\n')
549 % (subrelpath(self), srcurl))
549 % (subrelpath(self), srcurl))
550 remotebookmarks = other.listkeys('bookmarks')
550 self._repo.pull(other)
551 self._repo.pull(other)
551 bookmarks.updatefromremote(self._repo.ui, self._repo, other,
552 bookmarks.updatefromremote(self._repo.ui, self._repo,
552 srcurl)
553 remotebookmarks, srcurl)
553
554
554 @annotatesubrepoerror
555 @annotatesubrepoerror
555 def get(self, state, overwrite=False):
556 def get(self, state, overwrite=False):
@@ -204,6 +204,39 update a remote bookmark from a non-head
204 Y 3:f6fc62dde3c0
204 Y 3:f6fc62dde3c0
205 Z 1:0d2164f0ce0d
205 Z 1:0d2164f0ce0d
206
206
207 update a bookmark in the middle of a client pulling changes
208
209 $ cd ..
210 $ hg clone -q a pull-race
211 $ hg clone -q pull-race pull-race2
212 $ cd pull-race
213 $ hg up -q Y
214 $ echo c4 > f2
215 $ hg ci -Am4
216 $ echo c5 > f3
217 $ cat <<EOF > .hg/hgrc
218 > [hooks]
219 > outgoing.makecommit = hg ci -Am5; echo committed in pull-race
220 > EOF
221 $ cd ../pull-race2
222 $ hg pull
223 pulling from $TESTTMP/pull-race (glob)
224 searching for changes
225 adding changesets
226 adding f3
227 committed in pull-race
228 adding manifests
229 adding file changes
230 added 1 changesets with 1 changes to 1 files
231 updating bookmark Y
232 (run 'hg update' to get a working copy)
233 $ hg book
234 * @ 1:0d2164f0ce0d
235 X 1:0d2164f0ce0d
236 Y 4:b0a5eff05604
237 Z 1:0d2164f0ce0d
238 $ cd ../b
239
207 diverging a remote bookmark fails
240 diverging a remote bookmark fails
208
241
209 $ hg up -q 4e3505fd9583
242 $ hg up -q 4e3505fd9583
@@ -198,7 +198,6 listkeys hook
198 listkeys hook: HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'}
198 listkeys hook: HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'}
199 no changes found
199 no changes found
200 listkeys hook: HG_NAMESPACE=phases HG_VALUES={'cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b': '1', 'publishing': 'True'}
200 listkeys hook: HG_NAMESPACE=phases HG_VALUES={'cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b': '1', 'publishing': 'True'}
201 listkeys hook: HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'}
202 adding remote bookmark bar
201 adding remote bookmark bar
203 importing bookmark bar
202 importing bookmark bar
204 $ cd ../a
203 $ cd ../a
@@ -58,7 +58,6 expect error, pulling not allowed
58
58
59 $ req
59 $ req
60 pulling from http://localhost:$HGPORT/
60 pulling from http://localhost:$HGPORT/
61 searching for changes
62 abort: authorization failed
61 abort: authorization failed
63 % serve errors
62 % serve errors
64
63
General Comments 0
You need to be logged in to leave comments. Login now