##// END OF EJS Templates
bookmarks: separate bookmarks update code from localrepo's pull....
David Soria Parra -
r13646:31eac42d default
parent child Browse files
Show More
@@ -163,6 +163,28 b' def pushbookmark(repo, key, old, new):'
163 finally:
163 finally:
164 w.release()
164 w.release()
165
165
166 def updatefromremote(ui, repo, remote):
167 ui.debug("checking for updated bookmarks\n")
168 rb = remote.listkeys('bookmarks')
169 changed = False
170 for k in rb.keys():
171 if k in repo._bookmarks:
172 nr, nl = rb[k], repo._bookmarks[k]
173 if nr in repo:
174 cr = repo[nr]
175 cl = repo[nl]
176 if cl.rev() >= cr.rev():
177 continue
178 if cr in cl.descendants():
179 repo._bookmarks[k] = cr.node()
180 changed = True
181 ui.status(_("updating bookmark %s\n") % k)
182 else:
183 ui.warn(_("not updating divergent"
184 " bookmark %s\n") % k)
185 if changed:
186 write(repo)
187
166 def diff(ui, repo, remote):
188 def diff(ui, repo, remote):
167 ui.status(_("searching for changed bookmarks\n"))
189 ui.status(_("searching for changed bookmarks\n"))
168
190
@@ -2977,6 +2977,7 b' def pull(ui, repo, source="default", **o'
2977 raise util.Abort(err)
2977 raise util.Abort(err)
2978
2978
2979 modheads = repo.pull(other, heads=revs, force=opts.get('force'))
2979 modheads = repo.pull(other, heads=revs, force=opts.get('force'))
2980 bookmarks.updatefromremote(ui, repo, other)
2980 if checkout:
2981 if checkout:
2981 checkout = str(repo.changelog.rev(other.lookup(checkout)))
2982 checkout = str(repo.changelog.rev(other.lookup(checkout)))
2982 repo._subtoppath = source
2983 repo._subtoppath = source
@@ -1346,27 +1346,6 b' class localrepository(repo.repository):'
1346 finally:
1346 finally:
1347 lock.release()
1347 lock.release()
1348
1348
1349 self.ui.debug("checking for updated bookmarks\n")
1350 rb = remote.listkeys('bookmarks')
1351 changed = False
1352 for k in rb.keys():
1353 if k in self._bookmarks:
1354 nr, nl = rb[k], self._bookmarks[k]
1355 if nr in self:
1356 cr = self[nr]
1357 cl = self[nl]
1358 if cl.rev() >= cr.rev():
1359 continue
1360 if cr in cl.descendants():
1361 self._bookmarks[k] = cr.node()
1362 changed = True
1363 self.ui.status(_("updating bookmark %s\n") % k)
1364 else:
1365 self.ui.warn(_("not updating divergent"
1366 " bookmark %s\n") % k)
1367 if changed:
1368 bookmarks.write(self)
1369
1370 return result
1349 return result
1371
1350
1372 def checkpush(self, force, revs):
1351 def checkpush(self, force, revs):
@@ -8,7 +8,7 b''
8 import errno, os, re, xml.dom.minidom, shutil, urlparse, posixpath
8 import errno, os, re, xml.dom.minidom, shutil, urlparse, posixpath
9 import stat, subprocess, tarfile
9 import stat, subprocess, tarfile
10 from i18n import _
10 from i18n import _
11 import config, util, node, error, cmdutil
11 import config, util, node, error, cmdutil, bookmarks
12 hg = None
12 hg = None
13
13
14 nullstate = ('', '', 'empty')
14 nullstate = ('', '', 'empty')
@@ -441,6 +441,7 b' class hgsubrepo(abstractsubrepo):'
441 % (subrelpath(self), srcurl))
441 % (subrelpath(self), srcurl))
442 other = hg.repository(self._repo.ui, srcurl)
442 other = hg.repository(self._repo.ui, srcurl)
443 self._repo.pull(other)
443 self._repo.pull(other)
444 bookmarks.updatefromremote(self._repo.ui, self._repo, other)
444
445
445 def get(self, state, overwrite=False):
446 def get(self, state, overwrite=False):
446 self._get(state)
447 self._get(state)
@@ -105,20 +105,16 b' do not use the proxy if it is in the no '
105 * - - [*] "GET http://localhost:$HGPORT/?cmd=heads HTTP/1.1" - - (glob)
105 * - - [*] "GET http://localhost:$HGPORT/?cmd=heads HTTP/1.1" - - (glob)
106 * - - [*] "GET http://localhost:$HGPORT/?cmd=changegroup&roots=0000000000000000000000000000000000000000 HTTP/1.1" - - (glob)
106 * - - [*] "GET http://localhost:$HGPORT/?cmd=changegroup&roots=0000000000000000000000000000000000000000 HTTP/1.1" - - (glob)
107 * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys&namespace=bookmarks HTTP/1.1" - - (glob)
107 * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys&namespace=bookmarks HTTP/1.1" - - (glob)
108 * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob)
109 * - - [*] "GET http://localhost:$HGPORT/?cmd=heads HTTP/1.1" - - (glob)
110 * - - [*] "GET http://localhost:$HGPORT/?cmd=changegroup&roots=0000000000000000000000000000000000000000 HTTP/1.1" - - (glob)
108 * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys&namespace=bookmarks HTTP/1.1" - - (glob)
111 * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys&namespace=bookmarks HTTP/1.1" - - (glob)
109 * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob)
112 * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob)
110 * - - [*] "GET http://localhost:$HGPORT/?cmd=heads HTTP/1.1" - - (glob)
113 * - - [*] "GET http://localhost:$HGPORT/?cmd=heads HTTP/1.1" - - (glob)
111 * - - [*] "GET http://localhost:$HGPORT/?cmd=changegroup&roots=0000000000000000000000000000000000000000 HTTP/1.1" - - (glob)
114 * - - [*] "GET http://localhost:$HGPORT/?cmd=changegroup&roots=0000000000000000000000000000000000000000 HTTP/1.1" - - (glob)
112 * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys&namespace=bookmarks HTTP/1.1" - - (glob)
115 * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys&namespace=bookmarks HTTP/1.1" - - (glob)
113 * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys&namespace=bookmarks HTTP/1.1" - - (glob)
114 * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob)
116 * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob)
115 * - - [*] "GET http://localhost:$HGPORT/?cmd=heads HTTP/1.1" - - (glob)
117 * - - [*] "GET http://localhost:$HGPORT/?cmd=heads HTTP/1.1" - - (glob)
116 * - - [*] "GET http://localhost:$HGPORT/?cmd=changegroup&roots=0000000000000000000000000000000000000000 HTTP/1.1" - - (glob)
118 * - - [*] "GET http://localhost:$HGPORT/?cmd=changegroup&roots=0000000000000000000000000000000000000000 HTTP/1.1" - - (glob)
117 * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys&namespace=bookmarks HTTP/1.1" - - (glob)
119 * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys&namespace=bookmarks HTTP/1.1" - - (glob)
118 * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys&namespace=bookmarks HTTP/1.1" - - (glob)
119 * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob)
120 * - - [*] "GET http://localhost:$HGPORT/?cmd=heads HTTP/1.1" - - (glob)
121 * - - [*] "GET http://localhost:$HGPORT/?cmd=changegroup&roots=0000000000000000000000000000000000000000 HTTP/1.1" - - (glob)
122 * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys&namespace=bookmarks HTTP/1.1" - - (glob)
123 * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys&namespace=bookmarks HTTP/1.1" - - (glob)
124
120
General Comments 0
You need to be logged in to leave comments. Login now