RFE: hg import --bypass target should be customizable

Patrick Mézard pmezard at gmail.com
Wed Nov 23 08:34:14 CST 2011


Le 22/11/11 18:51, Marc Strapetz a écrit :
> I'm trying to import a self-created patch into an existing Mercurial
> repository with "hg import". Goal is to not touch the working copy, so
> I'm using --bypass. Unfortunately, --bypass will always use the working
> copy parent which is in general not the target changeset to which the
> patch should be applied. --exact would allow to specify the target
> "Parent" in the patch, but unfortunately it performs a final check
> whether "Node ID" from the patch matches resulting changeset ID, which
> isn't the case because it's self-created and it would be (too) hard to
> calculate the correct SHA.

Are you writing a mercurial extension? If so, wouldn't it be easier to pick and adapt what you need from command.py import_() function? I know duplicating code is bad but in this case you probably need only a third of the actual command code (no need to deal with options, no need for the non-bypass code path, etc.).

IIRC, we considered having an option to specify the parents, but we decided to go for the simple --bypass version first, as it was really a test-bed for the working dir-less patcher. Maybe a --bypass-parents taking a revset would be good enough.

--
Patrick Mézard


More information about the Mercurial-devel mailing list