Re: Have "hg strip" blacklist stripped revisions?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: Have "hg strip" blacklist stripped revisions?

Kevin Bullock-4
(switching from -devel to user list)

On 4 Nov 2010, at 9:15 PM, CG Linden wrote:

> An idea...
>
> After multiple occurrences of people committing back stripped revisions, I was wondering if it was possible to include a feature that would add changesets to a blacklist, and have pull/push fail if one of the blacklisted revs is to be included.

This is possible with a pretxnchangegroup hook on the central repo. I have this for one of my repos to blacklist a stripped branch:

[hooks]
pretxnchangegroup.stripdm = hg branches | awk '/^dm-edge/ { print "Please strip the dm-edge branch before pushing"; exit 1 }'

It even has a nice informative message. (Note this is likely only seen when pushing over ssh; I don't think the HTTP wire protocol captures remote stdout.)

You could blacklist particular changesets a similar way, with a shell script as the hook and a text file listing the bad cset ids; something like

#!/bin/sh
for cset in $(hg log --template '{node|short}\n' -r $HG_NODE:tip); do
  grep -Fq $cset stripped-changesets.txt && (echo Please strip blacklisted changeset $cset; exit 1)
done
exit 0

(assuming *n*x, untested, off the cuff, fear, fire, foes, warnings, etc.)

> I realize that full scale history editing may be more desirable, but this seems like a simple addition that doesn't go against the grain of mercurial's fundamental 'append only' design.

'strip' already goes against the core append-only design, which is why it's in an extension (MQ).

pacem in terris / mir / shanti / salaam / heiwa
Kevin R. Bullock

> Obviously, --force should override...
> --
> cg
> _______________________________________________
> Mercurial-devel mailing list
> [hidden email]
> http://selenic.com/mailman/listinfo/mercurial-devel

_______________________________________________
Mercurial mailing list
[hidden email]
http://selenic.com/mailman/listinfo/mercurial