Mercurial > public > mercurial-scm > hg
diff mercurial/discovery.py @ 16835:4267c840c481
bookmarks: allow existing remote bookmarks to become heads when pushing
author | Levi Bard <levi@unity3d.com> |
---|---|
date | Sun, 13 May 2012 10:21:27 +0200 |
parents | 9acb5cd19162 |
children | 91f3ac205816 |
line wrap: on
line diff
--- a/mercurial/discovery.py Fri Jun 01 17:05:31 2012 -0700 +++ b/mercurial/discovery.py Sun May 13 10:21:27 2012 +0200 @@ -226,11 +226,20 @@ # If there are more heads after the push than before, a suitable # error message, depending on unsynced status, is displayed. error = None + remotebookmarks = remote.listkeys('bookmarks') + localbookmarks = repo._bookmarks + for branch in branches: newhs = set(newmap[branch]) oldhs = set(oldmap[branch]) + dhs = None if len(newhs) > len(oldhs): - dhs = list(newhs - oldhs) + # strip updates to existing remote heads from the new heads list + bookmarkedheads = set([repo[bm].node() for bm in localbookmarks + if bm in remotebookmarks and + remote[bm] == repo[bm].ancestor(remote[bm])]) + dhs = list(newhs - bookmarkedheads - oldhs) + if dhs: if error is None: if branch not in ('default', None): error = _("push creates new remote head %s "