push should not allow to push diverged bookmark
Marc Strapetz
marc.strapetz at syntevo.com
Tue Aug 4 12:26:00 UTC 2015
When having a bookmark for which there exists a new remote commit, it's
still possible to push a diverged local commit without --force option. I
think it's more reasonable to disallow such pushes, similar as when
pushing a branch or a specific revision. The patch below should resolve
the problem.
-Marc
# HG changeset patch
# User Marc Strapetz <marc.strapetz at syntevo.com>
# Date 1438690573 -7200
# Tue Aug 04 14:16:13 2015 +0200
# Node ID 02624e707a527ded09612539b8e7fc26889679f7
# Parent eabba9c75061254ff62827f92df0f32491c74b3d
push: disallow pushing diverged bookmark using "hg push <bookmark>"
syntax without --force
diff -r eabba9c75061 -r 02624e707a52 mercurial/discovery.py
--- a/mercurial/discovery.py Fri Jun 26 18:45:29 2015 -0500
+++ b/mercurial/discovery.py Tue Aug 04 14:16:13 2015 +0200
@@ -265,7 +265,7 @@
if bookmarks.validdest(repo, rctx, lctx):
bookmarkedheads.add(lctx.node())
else:
- if bm in newbookmarks:
+ if bm in newbookmarks and not bm in remotebookmarks:
bookmarkedheads.add(repo[bm].node())
# 3. Check for new heads.
More information about the Mercurial-devel
mailing list