[PATCH 1 of 1] Enable commit to disallow recursive submodule commits

Dan Villiom Podlaski Christiansen danchr at gmail.com
Thu Apr 22 03:16:34 CDT 2010


On 22 Apr 2010, at 04:02, Michael Ekstrand wrote:

> # HG changeset patch
> # User Michael Ekstrand <michael at elehack.net>
> # Date 1271900106 18000
> # Node ID 64e512e0de2d91c6d7dc1975992ccb4b6f0ec46b
> # Parent  3213e8947975d7a8b44f6a11d063eb949fcb6bb5
> Enable commit to disallow recursive submodule commits
> 
> This patch adds support to commit for a 'commit.recursive' option, defaulting
> to true, which controls whether or not commit recursively commits submodules.
> If false and a submodule has uncommitted changes, commit fails unless the
> '--force' option is passed.  If --force is passed, then .hgsubstate is updated
> with the submodule's checked-out revision, if necessary, but not committed.
> 
> * Adds methods to subrepos to query working copy dirty state and current
>  revision.
> * Adds support to localrepo.commit for honoring the commit.recursive option.
> * Adds tests to test-subrepo for the new changes.

It seems to me that a general option would be nice as well. Currently, a repository with a broken .hgsub file is almost unusable; it might be worthwhile to have a way to completely disable the subrepo functionality.

> +                        if srepo.wcdirty() and not force:
> +                            fail(s, _("submodule working copy dirty"
> +                                      + " (--force to commit anyway)"))
> +                        else:
> +                            self.ui.status(_('subrepository %s changed'
> +                                             + ' (updating .hgsubstate)\n') % s)
> +                            state[s] = (state[s][0], srepo.curstate())

AFAICT the ‘+’ here is redundant. I'd suggest you remove it as might confuse gettext. (I haven't checked.) Also, I believe the Mercurial convention for long messages is more like this:

+                            msg = _('subrepository %s changed '
+                                    ' (updating .hgsubstate)\n')
+                            self.ui.status(msg % s)

One final suggestion: have you considered a less technical message? Users may not know that subrepo state is stored in a ‘.hgsubstate’ file.

--

Dan Villiom Podlaski Christiansen
danchr at gmail.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1943 bytes
Desc: not available
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20100422/e80c8673/attachment.bin>


More information about the Mercurial-devel mailing list