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

login
register
mail settings
Submitter Katsunori FUJIWARA
Date Aug. 23, 2014, 2:17 p.m.
Message ID <587606d1af38ae8c7a31.1408803453@feefifofum>
Download mbox | patch
Permalink /patch/5561/
State Superseded
Commit 0c838e7459a55726d3f55b29b0d7b26ca4ada2cb
Headers show

Comments

Katsunori FUJIWARA - Aug. 23, 2014, 2:17 p.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@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.
Augie Fackler - Aug. 23, 2014, 7:23 p.m.
On Sat, Aug 23, 2014 at 11:17:33PM +0900, FUJIWARA Katsunori wrote:
> # HG changeset patch
> # User FUJIWARA Katsunori <foozy@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"?

> +                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@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
Katsunori FUJIWARA - Aug. 24, 2014, 6:45 a.m.
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@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 ?

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@selenic.com
> > http://selenic.com/mailman/listinfo/mercurial-devel
> 

----------------------------------------------------------------------
[FUJIWARA Katsunori]                             foozy@lares.dti.ne.jp
Augie Fackler - Aug. 24, 2014, 5:34 p.m.
On Aug 24, 2014, at 2:45 AM, FUJIWARA Katsunori <foozy@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@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@selenic.com
>>> http://selenic.com/mailman/listinfo/mercurial-devel
>> 
> 
> ----------------------------------------------------------------------
> [FUJIWARA Katsunori]                             foozy@lares.dti.ne.jp

Patch

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")
+                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