[PATCH 3 of 3] import: show the warning message for failure of merging

Augie Fackler raf at durin42.com
Sun Aug 24 12:34:54 CDT 2014


On Aug 24, 2014, at 2:45 AM, FUJIWARA Katsunori <foozy at lares.dti.ne.jp> wrote:

> At Sat, 23 Aug 2014 15:23:27 -0400,
> Augie Fackler wrote:
>> 
>> On Sat, Aug 23, 2014 at 11:17:33PM +0900, FUJIWARA Katsunori wrote:
>>> # HG changeset patch
>>> # User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
>>> # Date 1408802630 -32400
>>> #      Sat Aug 23 23:03:50 2014 +0900
>>> # Node ID 587606d1af38ae8c7a314908a225b56457d628b4
>>> # Parent  3aefe8a4d8172c2733dd0fe3c48d733231aa76fc
>>> import: show the warning message for failure of merging
>>> 
>>> Before this patch, no message is shown for failure of merging at "hg
>>> import".
>>> 
>>> In such case, merging patch is imported as a normal revision silently,
>>> and it may confuse users.
>>> 
>>> diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
>>> --- a/mercurial/cmdutil.py
>>> +++ b/mercurial/cmdutil.py
>>> @@ -651,6 +651,10 @@
>>>                     p2 = repo[nullid]
>>>             except error.RepoError:
>>>                 p1, p2 = parents
>>> +            if p2.node() == nullid:
>>> +                msg = _("warning: import the patch as a normal revision\n"
>>> +                        "(use '--exact' to import merging patch certainly)\n")
>> 
>> Perhaps "use --exact to import the patch as a merge"?
> 
> You mean that we should ignore that "hg import" can import the patch
> merging two revisions without "--exact" (even though it should satisfy
> exacting conditions), for simplicity, don't you ?

Actually, I was trying to clarify what the hint meant. I'm not sure what the intended meaning was.

I'm honestly not sure what the import behavior should be on a merge - it never occurred to me to try it.

> 
> OK, I'll send revised one !
> 
> 
>>> +                ui.warn(msg)
>>>         else:
>>>             p1, p2 = parents
>>> 
>>> diff --git a/tests/test-import-merge.t b/tests/test-import-merge.t
>>> --- a/tests/test-import-merge.t
>>> +++ b/tests/test-import-merge.t
>>> @@ -72,6 +72,8 @@
>>>   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
>>>   $ hg import ../merge.diff
>>>   applying ../merge.diff
>>> +  warning: import the patch as a normal revision
>>> +  (use '--exact' to import merging patch certainly)
>>>   $ tipparents
>>>   2:890ecaa90481 addc
>>>   $ hg strip --no-backup tip
>>> @@ -105,6 +107,8 @@
>>>   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
>>>   $ hg import --bypass ../merge.diff
>>>   applying ../merge.diff
>>> +  warning: import the patch as a normal revision
>>> +  (use '--exact' to import merging patch certainly)
>>>   $ tipparents
>>>   2:890ecaa90481 addc
>>>   $ hg strip --no-backup tip
>>> _______________________________________________
>>> Mercurial-devel mailing list
>>> Mercurial-devel at selenic.com
>>> http://selenic.com/mailman/listinfo/mercurial-devel
>> 
> 
> ----------------------------------------------------------------------
> [FUJIWARA Katsunori]                             foozy at lares.dti.ne.jp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20140824/c542db5f/attachment.pgp>


More information about the Mercurial-devel mailing list