hg equivalent of git push -f?

Jeremy . voldermort at hotmail.com
Tue Mar 14 11:34:11 UTC 2017


How do regular hg users handle such a workflow? I presume not with a hook, although that would solve my problem as I described it.


The requirements are:

1) Programmers commit their work to feature branches.

2) These feature branches are regularly pushed to a central server for CI or so that others can view the code.

3) As this code is work in progress they regularly use git commit --amend && git push -f to update the server copy without cluttering history.


________________________________
From: Arne Babenhauserheide <arne_bab at web.de>


Jeremy . writes:

>>Alternatively you could create a push hook which automatically strips
>>the old changesets. The following example is for bookmarks, but you
>>could also just strip away the non-tip head on a force-push.
>
>>[hooks]
>>pushkey.delete-old-history = if test x"$HG_NAMESPACE" = x"bookmarks"; then $HG strip --hidden -r "::$HG_OLD - ::$HG_NEW"; hg update $HG_KEY; fi
>
> This would give the same workflow as git, other than that they are moved immediately to a backup file instead of being hidden until GC. I wonder if it could be done as an extension?

You only need to do this on the server, so an extension seems overkill
for this.

Best wishes,
Arne

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20170314/2ac8aaec/attachment-0002.html>


More information about the Mercurial mailing list