Prevent accidental commit of a versioned and localy changed file

Jelmer Vernooij jelmer at samba.org
Mon Jul 7 16:08:15 BST 2008


Am Montag, den 07.07.2008, 09:59 -0500 schrieb John Arbash Meinel:
> Sabin Iacob wrote:
> > Marius Gedminas wrote:
> >> On Fri, Jul 04, 2008 at 07:26:57PM +0300, Panagiotis Papadakos wrote:
> >>  
> >>> Lets say that I have a file on my local branch,
> >>> which is under version control. I need to make
> >>> some changes to this file so that the code of the branch
> >>> can work using my personal options (lets say
> >>> this is a config file). And I don't want to accidentally
> >>> commit the changes I have made to the central branch.
> >>> Is there any way I can somehow 'lock' the file?
> >>>     
> >>
> >> I've been missing this sort of thing in Subversion.  It would be nice if
> >> Bazaar had a way to mark files "uncommittable".
> >>   
> > 
> > I seem to remember something like this in tla (Gnu Arch): there was a
> > kind of files called "precious" which were copied if a new branch was
> > created, but weren't taken into account when committing (tla didn't
> > recognise them as source files).
> > 
> > 
> 
> I don't think this is quite what he wants. He wants a "version, but do not
> commit". The idea is basically when you have a config file, and you want to
> run out of the source tree.
> 
> The way I've always seen it done elsewhere is that you have a:
> 
> config.template
> 
> which you then copy to "config" and edit.
> 
> IMO, it is a much cleaner way of doing it.
> 
> That said, you could certainly put something like this together in a plugin. A
> simple pre-commit check should be able to do it. As a first draft, you could
> just abort if it tries to commit the file. A further version might just try to
> skip the file if it is being committed as part of a recursive commit.
> 
> Unfortunately, the point at which our current logic does a pre_commit check,
> doesn't let you modify the commit. Only abort it.
The start_commit hook I added a while ago for the etckeeper plugin does
allow modification of the commit. etckeeper uses it to modify
the .etckeeper file.

Cheers,

Jelmer
-- 
Jelmer Vernooij <jelmer at samba.org> - http://samba.org/~jelmer/
Jabber: jelmer at jabber.fsfe.org



More information about the bazaar mailing list