##// END OF EJS Templates
pull: move bookmark movements inside the `exchange.pull`...
Pierre-Yves David -
r22645:6e431e16 default
parent child Browse files
Show More
@@ -4960,16 +4960,8 b' def pull(ui, repo, source="default", **o'
4960 "so a rev cannot be specified.")
4960 "so a rev cannot be specified.")
4961 raise util.Abort(err)
4961 raise util.Abort(err)
4962
4962
4963 modheads = repo.pull(other, heads=revs, force=opts.get('force'))
4963 modheads = repo.pull(other, heads=revs, force=opts.get('force'),
4964 bookmarks.updatefromremote(ui, repo, remotebookmarks, other.url())
4964 bookmarks=opts.get('bookmark', ()))
4965 # update specified bookmarks
4966 if opts.get('bookmark'):
4967 marks = repo._bookmarks
4968 for b in opts['bookmark']:
4969 # explicit pull overrides local bookmark if any
4970 ui.status(_("importing bookmark %s\n") % b)
4971 marks[b] = repo[remotebookmarks[b]].node()
4972 marks.write()
4973 if checkout:
4965 if checkout:
4974 checkout = str(repo.changelog.rev(other.lookup(checkout)))
4966 checkout = str(repo.changelog.rev(other.lookup(checkout)))
4975 repo._subtoppath = source
4967 repo._subtoppath = source
@@ -781,7 +781,7 b' class pulloperation(object):'
781 if self._tr is not None:
781 if self._tr is not None:
782 self._tr.release()
782 self._tr.release()
783
783
784 def pull(repo, remote, heads=None, force=False):
784 def pull(repo, remote, heads=None, force=False, bookmarks=()):
785 pullop = pulloperation(repo, remote, heads, force)
785 pullop = pulloperation(repo, remote, heads, force)
786 if pullop.remote.local():
786 if pullop.remote.local():
787 missing = set(pullop.remote.requirements) - pullop.repo.supported
787 missing = set(pullop.remote.requirements) - pullop.repo.supported
@@ -791,6 +791,7 b' def pull(repo, remote, heads=None, force'
791 " %s") % (', '.join(sorted(missing)))
791 " %s") % (', '.join(sorted(missing)))
792 raise util.Abort(msg)
792 raise util.Abort(msg)
793
793
794 remotebookmarks = remote.listkeys('bookmarks')
794 lock = pullop.repo.lock()
795 lock = pullop.repo.lock()
795 try:
796 try:
796 _pulldiscovery(pullop)
797 _pulldiscovery(pullop)
@@ -807,6 +808,18 b' def pull(repo, remote, heads=None, force'
807 finally:
808 finally:
808 pullop.releasetransaction()
809 pullop.releasetransaction()
809 lock.release()
810 lock.release()
811 bookmod.updatefromremote(repo.ui, repo, remotebookmarks, remote.url())
812 # update specified bookmarks
813 if bookmarks:
814 marks = repo._bookmarks
815 writer = repo.ui.status
816 if repo.ui.configbool('ui', 'quietbookmarkmove', False):
817 writer = repo.ui.debug
818 for b in bookmarks:
819 # explicit pull overrides local bookmark if any
820 writer(_("importing bookmark %s\n") % b)
821 marks[b] = repo[remotebookmarks[b]].node()
822 marks.write()
810
823
811 return pullop.cgresult
824 return pullop.cgresult
812
825
@@ -1724,7 +1724,14 b' class localrepository(object):'
1724 # if we support it, stream in and adjust our requirements
1724 # if we support it, stream in and adjust our requirements
1725 if not streamreqs - self.supportedformats:
1725 if not streamreqs - self.supportedformats:
1726 return self.stream_in(remote, streamreqs)
1726 return self.stream_in(remote, streamreqs)
1727 return self.pull(remote, heads)
1727
1728 quiet = self.ui.backupconfig('ui', 'quietbookmarkmove')
1729 try:
1730 self.ui.setconfig('ui', 'quietbookmarkmove', True, 'clone')
1731 ret = self.pull(remote, heads)
1732 finally:
1733 self.ui.restoreconfig(quiet)
1734 return ret
1728
1735
1729 def pushkey(self, namespace, key, old, new):
1736 def pushkey(self, namespace, key, old, new):
1730 self.hook('prepushkey', throw=True, namespace=namespace, key=key,
1737 self.hook('prepushkey', throw=True, namespace=namespace, key=key,
@@ -196,6 +196,7 b' listkeys hook'
196 $ hg pull -B bar ../a
196 $ hg pull -B bar ../a
197 pulling from ../a
197 pulling from ../a
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 listkeys hook: HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'}
199 no changes found
200 no changes found
200 listkeys hook: HG_NAMESPACE=phases HG_VALUES={'cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b': '1', 'publishing': 'True'}
201 listkeys hook: HG_NAMESPACE=phases HG_VALUES={'cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b': '1', 'publishing': 'True'}
201 adding remote bookmark bar
202 adding remote bookmark bar
@@ -103,21 +103,25 b' do not use the proxy if it is in the no '
103 * - - [*] "GET http://localhost:$HGPORT/?cmd=stream_out HTTP/1.1" - - (glob)
103 * - - [*] "GET http://localhost:$HGPORT/?cmd=stream_out HTTP/1.1" - - (glob)
104 * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-hgarg-1:namespace=bookmarks (glob)
104 * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-hgarg-1:namespace=bookmarks (glob)
105 * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob)
105 * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob)
106 * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-hgarg-1:namespace=bookmarks (glob)
106 * - - [*] "GET http://localhost:$HGPORT/?cmd=batch HTTP/1.1" - - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D (glob)
107 * - - [*] "GET http://localhost:$HGPORT/?cmd=batch HTTP/1.1" - - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D (glob)
107 * - - [*] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-hgarg-1:common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629 (glob)
108 * - - [*] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-hgarg-1:common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629 (glob)
108 * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-hgarg-1:namespace=phases (glob)
109 * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-hgarg-1:namespace=phases (glob)
109 * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-hgarg-1:namespace=bookmarks (glob)
110 * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-hgarg-1:namespace=bookmarks (glob)
110 * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob)
111 * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob)
112 * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-hgarg-1:namespace=bookmarks (glob)
111 * - - [*] "GET http://localhost:$HGPORT/?cmd=batch HTTP/1.1" - - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D (glob)
113 * - - [*] "GET http://localhost:$HGPORT/?cmd=batch HTTP/1.1" - - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D (glob)
112 * - - [*] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-hgarg-1:common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629 (glob)
114 * - - [*] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-hgarg-1:common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629 (glob)
113 * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-hgarg-1:namespace=phases (glob)
115 * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-hgarg-1:namespace=phases (glob)
114 * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-hgarg-1:namespace=bookmarks (glob)
116 * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-hgarg-1:namespace=bookmarks (glob)
115 * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob)
117 * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob)
118 * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-hgarg-1:namespace=bookmarks (glob)
116 * - - [*] "GET http://localhost:$HGPORT/?cmd=batch HTTP/1.1" - - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D (glob)
119 * - - [*] "GET http://localhost:$HGPORT/?cmd=batch HTTP/1.1" - - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D (glob)
117 * - - [*] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-hgarg-1:common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629 (glob)
120 * - - [*] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-hgarg-1:common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629 (glob)
118 * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-hgarg-1:namespace=phases (glob)
121 * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-hgarg-1:namespace=phases (glob)
119 * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-hgarg-1:namespace=bookmarks (glob)
122 * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-hgarg-1:namespace=bookmarks (glob)
120 * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob)
123 * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob)
124 * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-hgarg-1:namespace=bookmarks (glob)
121 * - - [*] "GET http://localhost:$HGPORT/?cmd=batch HTTP/1.1" - - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D (glob)
125 * - - [*] "GET http://localhost:$HGPORT/?cmd=batch HTTP/1.1" - - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D (glob)
122 * - - [*] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-hgarg-1:common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629 (glob)
126 * - - [*] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-hgarg-1:common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629 (glob)
123 * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-hgarg-1:namespace=phases (glob)
127 * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-hgarg-1:namespace=phases (glob)
@@ -45,7 +45,6 b' expect error, cloning not allowed'
45 $ hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
45 $ hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
46 $ cat hg.pid >> $DAEMON_PIDS
46 $ cat hg.pid >> $DAEMON_PIDS
47 $ hg clone http://localhost:$HGPORT/ test4
47 $ hg clone http://localhost:$HGPORT/ test4
48 requesting all changes
49 abort: authorization failed
48 abort: authorization failed
50 [255]
49 [255]
51 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
50 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
@@ -515,6 +515,7 b' Both have new stuff in existing named br'
515 "GET /?cmd=between HTTP/1.1" 200 - x-hgarg-1:pairs=d8f638ac69e9ae8dea4f09f11d696546a912d961-d57206cc072a18317c1e381fb60aa31bd3401785
515 "GET /?cmd=between HTTP/1.1" 200 - x-hgarg-1:pairs=d8f638ac69e9ae8dea4f09f11d696546a912d961-d57206cc072a18317c1e381fb60aa31bd3401785
516 "GET /?cmd=capabilities HTTP/1.1" 200 -
516 "GET /?cmd=capabilities HTTP/1.1" 200 -
517 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks
517 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks
518 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks
518 "GET /?cmd=heads HTTP/1.1" 200 -
519 "GET /?cmd=heads HTTP/1.1" 200 -
519 "GET /?cmd=branches HTTP/1.1" 200 - x-hgarg-1:nodes=d8f638ac69e9ae8dea4f09f11d696546a912d961
520 "GET /?cmd=branches HTTP/1.1" 200 - x-hgarg-1:nodes=d8f638ac69e9ae8dea4f09f11d696546a912d961
520 "GET /?cmd=between HTTP/1.1" 200 - x-hgarg-1:pairs=d8f638ac69e9ae8dea4f09f11d696546a912d961-d57206cc072a18317c1e381fb60aa31bd3401785
521 "GET /?cmd=between HTTP/1.1" 200 - x-hgarg-1:pairs=d8f638ac69e9ae8dea4f09f11d696546a912d961-d57206cc072a18317c1e381fb60aa31bd3401785
General Comments 0
You need to be logged in to leave comments. Login now