[PATCH] convert: Add 'close' as a possible splicemap option
Mads Kiilerich
mads at kiilerich.com
Wed Jan 2 19:02:06 CST 2013
John Peacock wrote, On 01/02/2013 04:51 PM:
> # HG changeset patch
> # User John Peacock <john.peacock at messagesystems.com>
> # Date 1357141812 18000
> # Branch stable
> # Node ID 326d97248e8b753f01b41349e2e6e3163e26fae4
> # Parent 6d2ba9875d083e7acad3c1674d6b922a4b7bdb76
> convert: Add 'close' as a possible splicemap option.
A couple of minor details: The subject line should be all lower case and
without trailing ".".
> Sometimes a shared repo that makes extensive use of feature branches
> is not managed appropriately and a growing number of open but inactive
> branches litter the branches listing. Since there is no way to close
> multiple branches in a single commit (even though the act of
> closing is just altering metadata), cleaning up a repository like
> this can be an exercise in frustration and makes the history unclear.
>
> This patch extends the splicemap to accept a second type of line which
> signals a changeset to mark as being closed as part of the conversion.
> During the scanning of the source, the changeset matching the key has
> the changeset marked as closed in the extra metadata. Then later when
> that changeset is actually processed, the original source parents are
> used for history and the 'close' value is just ignored.
>
> It seems unlikely that a single changeset would require both synthetic
> history as well as being closed, so that case is not handled. Either
> new parent(s) can be synthesized OR a branch can be closed, but not both.
This seems like a heavy overload of splicemap.
It is nice to avoid adding extra parameters and config files, but this
might be too much of a hack.
I wonder: couldn't these branches easily be closed with some simple hg
commands after the conversion has completed?
hg up -r "converted(86d3d4ecdf64)" && hg commit --close-branch
And if you want some functionality for closing branches, shouldn't there
also be a way to close them topologically by (dummy) merging them?
Creating a 'splicemap' format for that would be a can of worms ... but
it is quite obvious how to do that if using a script with hg commands.
> diff --git a/tests/test-convert-splicemap.t b/tests/test-convert-splicemap.t
> --- a/tests/test-convert-splicemap.t
> +++ b/tests/test-convert-splicemap.t
> @@ -220,3 +220,46 @@
> scanning source...
> abort: unknown splice map parent: deadbeef102a90ea7b4a3361e4082ed620918c26
> [255]
> +
> +Test branch closing
This could probably be tested with a minor modification of an existing test.
> +
> + $ hg init closebranch
> + $ cd closebranch
> + $ echo a > a
> + $ hg ci -Am createa
> + adding a
> + $ hg branch newa
> + marked working directory as branch newa
> + (branches are permanent and global, did you want a bookmark?)
> + $ hg echo aa > a
> + hg: unknown command 'echo'
> + [255]
???
> + $ hg ci -m newa
> + $ hg up default
> + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
> + $ hg merge newa
> + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
> + (branch merge, don't forget to commit)
> + $ hg ci -m mergenewa
> + $ hg branches
> + default 2:5502a03b9720
> + newa 1:86d3d4ecdf64 (inactive)
> +
> +
> + $ hg log -r1 --template "{node} close\n" > ../splicemap.cb
FWIW, for readability I would prefer to have the splicemap content
explicit in the test.
/Mads
More information about the Mercurial-devel
mailing list