[PATCH remotenames-ext] remotenames: push anonymous head if --force is given

Pulkit Goyal 7895pulkit at gmail.com
Wed Oct 4 21:40:11 UTC 2017


# HG changeset patch
# User Pulkit Goyal <7895pulkit at gmail.com>
# Date 1507153197 -19800
#      Thu Oct 05 03:09:57 2017 +0530
# Node ID b3cf58915bc36b7e01470f6a55dc5bd8b8f4cc9a
# Parent  e7cce2b6198ace7769e2c68a5b67eddde794cfeb
remotenames: push anonymous head if --force is given

If force is passed, we should not care whether --anon is passed or not as the
user forced the push and we should push the anonymous head also.

I noticed this when I enabled the extension and got the anonymous head warning.
Whenever I push to my personal repo and see error while, I just pass -f but
this time, passing -f didn't work which should.

diff --git a/remotenames.py b/remotenames.py
--- a/remotenames.py
+++ b/remotenames.py
@@ -853,7 +853,7 @@
 
     if not pushop.to:
         ret = exchange._pushdiscoverybookmarks(pushop)
-        if not pushop.allowanon:
+        if not pushop.allowanon and not pushop.force:
             # check to make sure we don't push an anonymous head
             if pushop.revs:
                 revs = set(pushop.revs)


More information about the Mercurial-devel mailing list