Patchwork merge: let the user choose to merge, keep local or keep remote subrepo revisions

login
register
mail settings
Submitter Kevin Bullock
Date Sept. 25, 2013, 4 a.m.
Message ID <47848A31-F3F2-4E28-ABC4-928FD1FC118D@ringworld.org>
Download mbox | patch
Permalink /patch/2628/
State Superseded
Commit 5e10d41e7b9cffe99ab798c066038518ec51e494
Headers show

Comments

Angel Ezquerra - Sept. 25, 2013, 6:20 a.m.
On Wed, Sep 25, 2013 at 6:00 AM, Kevin Bullock
<kbullock+mercurial@ringworld.org> wrote:
> On 7 Sep 2013, at 12:09 AM, Angel Ezquerra wrote:
>
>> # HG changeset patch
>> # User Angel Ezquerra <angel.ezquerra@gmail.com>
>> # Date 1378420708 -7200
>> #      Fri Sep 06 00:38:28 2013 +0200
>> # Node ID 15548e5b1c00bd2f261e3c81d39f2465263bc3c3
>> # Parent  1d07bf106c2ad1c7ef5e257e754ca8d858bd04b0
>> merge: let the user choose to merge, keep local or keep remote subrepo revisions
>
> Fails tests:

Sorry about that. I did not have git nor svn installed on my machine.
I installed them, re ran the tests and fixed them. I'll send an
updated patch in a minute.

BTW, in the last "note" on the commit message I said:

"I don't know of a way to test the "keep local" and "keep remote" options (i.e.
to force the test to choose those options)."

Is that a problem? I tested it manually and it does work fine, but I'd
rather have an automated test. The problem is that I don't know of a
way to tell run-tests to answer "l" or "r" to the prompt that asks
which subrepo revision to use?

Cheers,

Angel
Augie Fackler - Sept. 26, 2013, 1:58 p.m.
On Sep 25, 2013, at 2:20 AM, Angel Ezquerra <angel.ezquerra@gmail.com> wrote:

> On Wed, Sep 25, 2013 at 6:00 AM, Kevin Bullock
> <kbullock+mercurial@ringworld.org> wrote:
>> On 7 Sep 2013, at 12:09 AM, Angel Ezquerra wrote:
>> 
>>> # HG changeset patch
>>> # User Angel Ezquerra <angel.ezquerra@gmail.com>
>>> # Date 1378420708 -7200
>>> #      Fri Sep 06 00:38:28 2013 +0200
>>> # Node ID 15548e5b1c00bd2f261e3c81d39f2465263bc3c3
>>> # Parent  1d07bf106c2ad1c7ef5e257e754ca8d858bd04b0
>>> merge: let the user choose to merge, keep local or keep remote subrepo revisions
>> 
>> Fails tests:
> 
> Sorry about that. I did not have git nor svn installed on my machine.
> I installed them, re ran the tests and fixed them. I'll send an
> updated patch in a minute.
> 
> BTW, in the last "note" on the commit message I said:
> 
> "I don't know of a way to test the "keep local" and "keep remote" options (i.e.
> to force the test to choose those options)."
> 
> Is that a problem? I tested it manually and it does work fine, but I'd
> rather have an automated test. The problem is that I don't know of a
> way to tell run-tests to answer "l" or "r" to the prompt that asks
> which subrepo revision to use?

HGMERGE=internal:local
or
HGMERGE=internal:other

might help?

> 
> Cheers,
> 
> Angel
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
Angel Ezquerra - Sept. 26, 2013, 10:09 p.m.
On Thu, Sep 26, 2013 at 3:58 PM, Augie Fackler <raf@durin42.com> wrote:
>
> On Sep 25, 2013, at 2:20 AM, Angel Ezquerra <angel.ezquerra@gmail.com> wrote:
>
>> On Wed, Sep 25, 2013 at 6:00 AM, Kevin Bullock
>> <kbullock+mercurial@ringworld.org> wrote:
>>> On 7 Sep 2013, at 12:09 AM, Angel Ezquerra wrote:
>>>
>>>> # HG changeset patch
>>>> # User Angel Ezquerra <angel.ezquerra@gmail.com>
>>>> # Date 1378420708 -7200
>>>> #      Fri Sep 06 00:38:28 2013 +0200
>>>> # Node ID 15548e5b1c00bd2f261e3c81d39f2465263bc3c3
>>>> # Parent  1d07bf106c2ad1c7ef5e257e754ca8d858bd04b0
>>>> merge: let the user choose to merge, keep local or keep remote subrepo revisions
>>>
>>> Fails tests:
>>
>> Sorry about that. I did not have git nor svn installed on my machine.
>> I installed them, re ran the tests and fixed them. I'll send an
>> updated patch in a minute.
>>
>> BTW, in the last "note" on the commit message I said:
>>
>> "I don't know of a way to test the "keep local" and "keep remote" options (i.e.
>> to force the test to choose those options)."
>>
>> Is that a problem? I tested it manually and it does work fine, but I'd
>> rather have an automated test. The problem is that I don't know of a
>> way to tell run-tests to answer "l" or "r" to the prompt that asks
>> which subrepo revision to use?
>
> HGMERGE=internal:local
> or
> HGMERGE=internal:other
>
> might help?

I'm no expert on that part of the code but I believe that the
internal:xxx tools are only used by filemerge, and thus they are not
taken into account by subrepo.merge. Perhaps it should take them into
account?

That being said, the ideal solution to the problem of testing the "l"
and "o" answers to the merge prompt would be to be able to chose the
answer to the prompt on a prompt by prompt basis. However I don't
think there is a way to do that. I checked Brodie Rao's cram tool
documentation (https://pypi.python.org/pypi/cram) which is based on
mercurial's unified test format, hoping that it might suggest of a way
to do this but it seems there isn't. Perhaps Brodie or Matt can give
their two cents?

Cheers,

Angel

Patch

--- /home/kbullock/hg/hg/tests/test-subrepo-svn.t
+++ /home/kbullock/hg/hg/tests/test-subrepo-svn.t.err
@@ -319,6 +319,8 @@ 
   2M
   $ cd ..
   $ hg update tip
+   subrepository s diverged (local revision: 2, remote revision: 3)
+  (M)erge, keep (l)ocal or keep (r)emote? m
    subrepository sources for s differ
   use (l)ocal source (2) or (r)emote source (3)?
    l
@@ -349,6 +351,8 @@ 
   $ svn update -qr 1
   $ cd ..
   $ hg update 1
+   subrepository s diverged (local revision: 3, remote revision: 2)
+  (M)erge, keep (l)ocal or keep (r)emote? m
    subrepository sources for s differ (in checked out version)
   use (l)ocal source (1) or (r)emote source (2)?
    l
@@ -371,6 +375,8 @@ 
   $ hg id -n
   1+
   $ hg update tip
+   subrepository s diverged (local revision: 3, remote revision: 3)
+  (M)erge, keep (l)ocal or keep (r)emote? m
    subrepository sources for s differ
   use (l)ocal source (1) or (r)emote source (3)?
    l
@@ -404,6 +410,8 @@ 
   $ svn update -qr 2
   $ cd ..
   $ hg update 1
+   subrepository s diverged (local revision: 3, remote revision: 2)
+  (M)erge, keep (l)ocal or keep (r)emote? m
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg id -n
   1+

--- /home/kbullock/hg/hg/tests/test-subrepo-git.t
+++ /home/kbullock/hg/hg/tests/test-subrepo-git.t.err
@@ -155,6 +155,8 @@ 
   added 1 changesets with 1 changes to 1 files (+1 heads)
   (run 'hg heads' to see heads, 'hg merge' to merge)
   $ hg merge 2>/dev/null
+   subrepository s diverged (local revision: 796959400868, remote revision: aa84837ccfbd)
+  (M)erge, keep (l)ocal or keep (r)emote? m
   pulling subrepo s from $TESTTMP/gitroot
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   (branch merge, don't forget to commit)
@@ -462,6 +464,8 @@ 
   da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7
   $ cd ..
   $ hg update 4
+   subrepository s diverged (local revision: da5f5b1d8ffc, remote revision: aa84837ccfbd)
+  (M)erge, keep (l)ocal or keep (r)emote? m
    subrepository sources for s differ
   use (l)ocal source (da5f5b1) or (r)emote source (aa84837)?
    l
@@ -487,6 +491,8 @@ 
   HEAD is now at aa84837... f
   $ cd ..
   $ hg update 1
+   subrepository s diverged (local revision: 32a343883b74, remote revision: da5f5b1d8ffc)
+  (M)erge, keep (l)ocal or keep (r)emote? m
    subrepository sources for s differ (in checked out version)
   use (l)ocal source (32a3438) or (r)emote source (da5f5b1)?
    l
@@ -508,6 +514,8 @@ 
   $ hg id -n
   1+
   $ hg update 7
+   subrepository s diverged (local revision: 32a343883b74, remote revision: 32a343883b74)
+  (M)erge, keep (l)ocal or keep (r)emote? m
    subrepository sources for s differ
   use (l)ocal source (32a3438) or (r)emote source (32a3438)?
    l