[PATCH] allow localrepo.commit to store arbitrary data into the changelog dictionary
Thomas Arendsen Hein
thomas at intevation.de
Tue Nov 7 08:12:07 UTC 2006
* Brendan Cully <brendan at kublai.com> [20061107 01:39]:
> # HG changeset patch
> # User Brendan Cully <brendan at kublai.com>
> # Date 1162858840 28800
> # Node ID 1e87c5f4fad204fdcd4331e9c52c5d9b60d9dd3d
> # Parent cf001fb04109a27e550e0f06d095d02dfad884bd
> Export changelog dict in localrepo.commit
>
> diff -r cf001fb04109 -r 1e87c5f4fad2 mercurial/localrepo.py
> --- a/mercurial/localrepo.py Sun Nov 05 21:57:52 2006 +0100
> +++ b/mercurial/localrepo.py Mon Nov 06 16:20:40 2006 -0800
> @@ -618,10 +618,12 @@ class localrepository(repo.repository):
>
> def commit(self, files=None, text="", user=None, date=None,
> match=util.always, force=False, lock=None, wlock=None,
> - force_editor=False):
> + force_editor=False, extra=None):
> commit = []
> remove = []
> changed = []
> + if not extra:
> + extra = {}
> ...
> extra["branch"] = branchname
> n = self.changelog.add(mn, changed + remove, text, tr, p1, p2,
This yields minor inconsistent behaviour:
myextra = {'foo': 'bar'}
commit(..., extra=myextra)
Now myextra contains foo and branch, but
myextra = {}
commit(..., extra=myextra)
Now myextra contains foo, but not branch.
So "if extra is None:" might be more consistent here.
I haven't looked at the transplant code, so no comments for that,
but +1 for the commit-extra with the above modification.
Thomas
--
Email: thomas at intevation.de
http://intevation.de/~thomas/
More information about the Mercurial-devel
mailing list