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

Pierre-Yves David pierre-yves.david at ens-lyon.org
Wed Aug 27 16:00:14 CDT 2014



On 08/27/2014 04:24 PM, FUJIWARA Katsunori wrote:
> # HG changeset patch
> # User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
> # Date 1409148606 -32400
> #      Wed Aug 27 23:10:06 2014 +0900
> # Node ID e1de69b4b43f21021987bfd410d4e7a7f3d29701
> # Parent  926bc0d3b595caf37c5d70833a347eb43285de2f
> import: show the warning message for failure of merging

This seems to have been ninja queued by Matt (and published)

>
> 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.
>
> For simplicity, this patch recommends just using "--exact", even
> though importing the merging patch itself is possible without it if:
>
>    - the hash of the 1st parent in the patch is equal to one of the
>      patch imported just before (or the parent of the working
>      directory, for the 1st patch of the series), and
>
>    - the hash of the 2nd parent in the patch is known in the local
>      repository
>
> diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
> --- a/mercurial/cmdutil.py
> +++ b/mercurial/cmdutil.py
> @@ -651,6 +651,9 @@
>                       p2 = repo[nullid]
>               except error.RepoError:
>                   p1, p2 = parents
> +            if p2.node() == nullid:
> +                ui.warn(_("warning: import the patch as a normal revision\n"
> +                          "(use --exact to import the patch as a merge)\n"))
>           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 the patch as a merge)
>     $ 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 the patch as a merge)
>     $ 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
>

-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list