comparison mercurial/localrepo.py @ 19515:14c91b18d798 stable

bookmarks: update only proper bookmarks on push -r/-B (issue 3973) Make push -r/-B update only these bookmarks that point to pushed revisions or their ancestors, so we can be sure that commit pointed by bookmark is present in the remote reposiory. Previously push tried to update all shared bookmarks.
author Wojciech Lopata <lopek@fb.com>
date Fri, 26 Jul 2013 13:34:51 -0700
parents 93635f69c93b
children 00140039bd8f 9789670992d6
comparison
equal deleted inserted replaced
19514:cfdae231ba78 19515:14c91b18d798
1949 if locallock is not None: 1949 if locallock is not None:
1950 locallock.release() 1950 locallock.release()
1951 1951
1952 self.ui.debug("checking for updated bookmarks\n") 1952 self.ui.debug("checking for updated bookmarks\n")
1953 rb = remote.listkeys('bookmarks') 1953 rb = remote.listkeys('bookmarks')
1954 revnums = map(unfi.changelog.rev, revs or [])
1955 ancestors = [
1956 a for a in unfi.changelog.ancestors(revnums, inclusive=True)]
1954 for k in rb.keys(): 1957 for k in rb.keys():
1955 if k in unfi._bookmarks: 1958 if k in unfi._bookmarks:
1956 nr, nl = rb[k], hex(self._bookmarks[k]) 1959 nr, nl = rb[k], hex(self._bookmarks[k])
1957 if nr in unfi: 1960 if nr in unfi:
1958 cr = unfi[nr] 1961 cr = unfi[nr]
1959 cl = unfi[nl] 1962 cl = unfi[nl]
1960 if bookmarks.validdest(unfi, cr, cl): 1963 if bookmarks.validdest(unfi, cr, cl):
1964 if ancestors and cl.rev() not in ancestors:
1965 continue
1961 r = remote.pushkey('bookmarks', k, nr, nl) 1966 r = remote.pushkey('bookmarks', k, nr, nl)
1962 if r: 1967 if r:
1963 self.ui.status(_("updating bookmark %s\n") % k) 1968 self.ui.status(_("updating bookmark %s\n") % k)
1964 else: 1969 else:
1965 self.ui.warn(_('updating bookmark %s' 1970 self.ui.warn(_('updating bookmark %s'