hg equivalent of git push -f?
Scott Palmer
swpalmer at gmail.com
Tue Mar 14 12:09:22 UTC 2017
> On Mar 14, 2017, at 7:34 AM, Jeremy . <voldermort at hotmail.com> 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.
We use a workflow where there are two clones on the server. The “main” repo, where all the finished work is pushed as features and fixes are released, and a non-publishing “staging” repo where development takes place. We use bookmarks to track development of different features or fixes happening in the staging repo. When features are released we pull from the main repo, update to the ‘@‘ bookmark, merge in the feature/fix bookmark, push to ’staging’ and push only the updated ‘@‘ back to the main repo.
With this workflow we have the option of folding the feature changesets, and/or rebasing the features instead of merging, but we can easily collaborate on a feature by sharing via the staging repo. The other bookmarks in the staging repo also provide visibility as to what other changes are happening in that code base.
The “staging” and “main” repos are treated somewhat like “dev” and “stable” named branches. They are in separate clones simply to allow for marking the “dev” side as non-publishing, but in your case it can be used to keep the “main” repo “uncluttered.”
We also have some scripts that assist with following the dev process by automating some of the management of the bookmarks.
Scott
>
>
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20170314/c5e58f67/attachment-0002.html>
More information about the Mercurial
mailing list