hg equivalent of git push -f?

Jan Vrany jan.vrany at fit.cvut.cz
Tue Mar 14 11:52:33 UTC 2017


On Tue, 2017-03-14 at 11:34 +0000, Jeremy . wrote:
> 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.

I'm using bookmarks and evolve extension to do something quite 
similar. So after hacking (amending, rebasing, folding,...) 
I do a 

hg push -B . staging

Works for me. Indeed, obsolete changes pile up on the (staging) 
server but that's fine with me. This way I have a backup of
intermediate steps and dead-ends if need comes. 

HTH, Jan
> 
> 
> 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
> 
> _______________________________________________
> Mercurial mailing list
> Mercurial at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial



More information about the Mercurial mailing list