##// END OF EJS Templates
bookmarks: rewrite pushing bookmarks in "localrepository.push()" by "compare()"...
FUJIWARA Katsunori -
r20027:4b06b2a4 default
parent child Browse files
Show More
@@ -364,6 +364,22 b' def updatefromremote(ui, repo, remotemar'
364 364 writer(msg)
365 365 localmarks.write()
366 366
367 def updateremote(ui, repo, remote, revs):
368 ui.debug("checking for updated bookmarks\n")
369 revnums = map(repo.changelog.rev, revs or [])
370 ancestors = [a for a in repo.changelog.ancestors(revnums, inclusive=True)]
371 (addsrc, adddst, advsrc, advdst, diverge, differ, invalid
372 ) = compare(repo, repo._bookmarks, remote.listkeys('bookmarks'),
373 srchex=hex)
374
375 for b, scid, dcid in advsrc:
376 if ancestors and repo[scid].rev() not in ancestors:
377 continue
378 if remote.pushkey('bookmarks', b, dcid, scid):
379 ui.status(_("updating bookmark %s\n") % b)
380 else:
381 ui.warn(_('updating bookmark %s failed!\n') % b)
382
367 383 def pushtoremote(ui, repo, remote, targets):
368 384 (addsrc, adddst, advsrc, advdst, diverge, differ, invalid
369 385 ) = compare(repo, repo._bookmarks, remote.listkeys('bookmarks'),
@@ -1976,27 +1976,7 b' class localrepository(object):'
1976 1976 if locallock is not None:
1977 1977 locallock.release()
1978 1978
1979 self.ui.debug("checking for updated bookmarks\n")
1980 rb = remote.listkeys('bookmarks')
1981 revnums = map(unfi.changelog.rev, revs or [])
1982 ancestors = [
1983 a for a in unfi.changelog.ancestors(revnums, inclusive=True)]
1984 for k in rb.keys():
1985 if k in unfi._bookmarks:
1986 nr, nl = rb[k], hex(self._bookmarks[k])
1987 if nr in unfi:
1988 cr = unfi[nr]
1989 cl = unfi[nl]
1990 if bookmarks.validdest(unfi, cr, cl):
1991 if ancestors and cl.rev() not in ancestors:
1992 continue
1993 r = remote.pushkey('bookmarks', k, nr, nl)
1994 if r:
1995 self.ui.status(_("updating bookmark %s\n") % k)
1996 else:
1997 self.ui.warn(_('updating bookmark %s'
1998 ' failed!\n') % k)
1999
1979 bookmarks.updateremote(self.ui, unfi, remote, revs)
2000 1980 return ret
2001 1981
2002 1982 def changegroupinfo(self, nodes, source):
General Comments 0
You need to be logged in to leave comments. Login now