Mercurial > hg > hg-git
changeset 933:07f03124e1b9
git_handler: remove pre-2.8 code for bookmarks
author | Sean Farley <sean@farley.io> |
---|---|
date | Fri, 15 May 2015 14:02:55 -0700 |
parents | f33faedc1add |
children | 7b89630a2a48 |
files | hggit/git_handler.py |
diffstat | 1 files changed, 6 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/hggit/git_handler.py +++ b/hggit/git_handler.py @@ -15,15 +15,10 @@ from dulwich import config as dul_config from dulwich import diff_tree -try: - from mercurial import bookmarks - bookmarks.update - from mercurial import commands -except ImportError: - from hgext import bookmarks - from mercurial.i18n import _ from mercurial.node import hex, bin, nullid +from mercurial import bookmarks +from mercurial import commands from mercurial import context, util as hgutil from mercurial import url @@ -266,8 +261,8 @@ self.update_remote_branches('default', refs) # "Activate" a tipmost bookmark. - bms = getattr(self.repo['tip'], 'bookmarks', - lambda: None)() + bms = self.repo['tip'].bookmarks() + if bms: try: bookmarks.activate(self.repo, bms[0]) @@ -1281,11 +1276,7 @@ def update_hg_bookmarks(self, refs): try: - oldbm = getattr(bookmarks, 'parse', None) - if oldbm: - bms = bookmarks.parse(self.repo) - else: - bms = self.repo._bookmarks + bms = self.repo._bookmarks heads = dict([(ref[11:], refs[ref]) for ref in refs if ref.startswith('refs/heads/')]) @@ -1308,14 +1299,7 @@ bms[head + suffix] = hgsha if heads: - if oldbm: - bookmarks.write(self.repo, bms) - else: - self.repo._bookmarks = bms - if getattr(bms, 'write', None): # hg >= 2.5 - bms.write() - else: # hg < 2.5 - bookmarks.write(self.repo) + bms.write() except AttributeError: self.ui.warn(_('creating bookmarks failed, do you have'