[PATCH 2 of 2] add --force to commit options

Johan Euphrosine proppy at google.com
Tue Jan 10 05:08:57 CST 2012


Thanks a lot for taking the time to review my poorly submitted patch,
comments below.

On Tue, Jan 10, 2012 at 2:02 AM, Matt Mackall <mpm at selenic.com> wrote:
> On Mon, 2012-01-09 at 14:46 +0100, Johan Euphrosine wrote:
>> # HG changeset patch
>> # User Johan Euphrosine <proppy at google.com>
>> # Date 1326116607 -3600
>> # Node ID a08547027b43603f26e71fd03f855fdd8b226a94
>> # Parent  afdf4f5bac6147476ef4834707e5bfd687e39202
>> add --force to commit options
>
> What's the rationale for this?

hg commit normally allow you to commit a repository with dirty
subrepos using the -X command line flag.

I noticed that this was not allowed for merge commit, but that there
was code in localrepo.py to deal precisely with that scenario:
http://hg.intevation.org/mercurial/crew/file/a814f8fcc65a/mercurial/localrepo.py#l1073

So I though it would be good to connect the dots between
localrepo.py:commit Force argument, and the --force command line flag.

>
> "It allows to do a merge --force and a merge commit if a subrepos is in
> a dirty state."
>
> I usually don't not read 0 of X messages, as a matter of both habit and
> principle. If it's not in the commit summary, for historical purposes,
> it does not exist.

I was confused because that was the default behavior with submitting
multiple patch with hg mail qtip:qbase, I will try to submit both
patch separately them.

> But even when I've found your description, I have no clear idea of what
> it means, or why/when it would be a good idea. It certainly seems like a
> very bad idea to me.

I will re-submit the patches with a more detailed description.

>
>
>> diff -r afdf4f5bac61 -r a08547027b43 mercurial/commands.py
>> --- a/mercurial/commands.py   Mon Dec 26 15:01:06 2011 +0100
>> +++ b/mercurial/commands.py   Mon Jan 09 14:43:27 2012 +0100
>> @@ -1154,6 +1154,7 @@
>>       _('mark new/missing files as added/removed before committing')),
>>      ('', 'close-branch', None,
>>       _('mark a branch as closed, hiding it from the branch list')),
>> +    ('f', 'force', None, _('force a merge commit with outstanding changes'))
>
> I'm sure it allows lots of bad behavior beyond that.
>
>>      ] + walkopts + commitopts + commitopts2 + subrepoopts,
>>      _('[OPTION]... [FILE]...'))
>>  def commit(ui, repo, *pats, **opts):
>> @@ -1195,7 +1196,7 @@
>>
>>      def commitfunc(ui, repo, message, match, opts):
>>          return repo.commit(message, opts.get('user'), opts.get('date'), match,
>> -                           editor=e, extra=extra)
>> +                           editor=e, extra=extra, force=opts.get('force'))
>>
>>      branch = repo[None].branch()
>>      bheads = repo.branchheads(branch)
>> _______________________________________________
>> Mercurial-devel mailing list
>> Mercurial-devel at selenic.com
>> http://selenic.com/mailman/listinfo/mercurial-devel
>
>
> --
> Mathematics is the supreme nostalgia of our time.
>
>



-- 
Johan Euphrosine (proppy)
Developer Programs Engineer
Google Developer Relations


More information about the Mercurial-devel mailing list