[PATCH] convert: Add 'close' as a possible splicemap option

John Peacock john.peacock at messagesystems.com
Thu Jan 3 08:59:43 CST 2013


On 01/02/2013 08:02 PM, Mads Kiilerich wrote:
> 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 ".".

Thanks for being patient with me; I have reread the applicable wiki page 
(again)... ;-)

> 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.

The issue is that any solution like this has the same basic 
functionality as splicemap: key [values].  I could have added an 
additional option file (--closemap) but it would wind up being an almost 
literal copy/paste of the splicemap code.  Perhaps making a generic 
mapping implementation that supported different modes:

   key action [args]

would ultimately be cleaner.  For now <action> would only be "splice" 
and now "close", but it could be extended to "merge" (as you mention below).

> 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

Sure, but we have 56 of these branches, so the post-conversion history 
would just have a lot of effectively useless commits as cleanup.  Much 
nicer to just close them during the conversion.  If there was a way to 
create a transaction affecting the metadata for multiple branches in a 
single commit, that would be different (and I suspect much harder, if 
not impossible).

> 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.

In this case, all of the branches I was interested in closing were 
inactive (already merged).  Branches that should be closed with (dummy) 
merges are legitimate history cleanup, and I wouldn't hesitate to do 
those post conversion.  That is useful history; setting what is 
effectively a single flag in a header is not useful history.

>> +  $ hg echo aa > a
>> +  hg: unknown command 'echo'
>> +  [255]
>
> ???

Oops!  Copypasta (or rather that `hg` is preprogrammed into my fingers 
as the prefix for any command these days). ;-)

>> +  $ hg log -r1 --template "{node} close\n" > ../splicemap.cb
>
> FWIW, for readability I would prefer to have the splicemap content
> explicit in the test.

It wasn't clear to me that the node value would be consistent when rerun 
by different people.  In fact, while trying to write a different test, 
the initial repo had epoch 0 date (Jan 1, 1970), but the repo created by 
convert wound up with the current date.  There may be some subtlety I am 
missing...

John


More information about the Mercurial-devel mailing list