No subject


Sun Aug 16 13:15:20 CDT 2009


then
changed the logic, but did not update the comment in the output, so that the
test
is correct with the current logic (no update crossing heads of the same
branch),
but the comment is wrong.

I would like Matt and the crew to look again at the inclusion of Stuart
patch series
to get update from a clean work tree between any heads working without any
-c or -C.

Then, the last update in test-merge5 will succeed again.

Regards.
Gilles.

On Wed, Sep 16, 2009 at 1:07 AM, Adrian Buehlmann <adrian at cadifra.com>wrote:

> Hi Matt and list
>
> Today I ran across the problem that I had to specify -c in
> order to be able to update from one head to another.
>
> I noticed that the error message I get without -c seems
> not quite correct, as mercurial recommends to use -C (big)
> even though -c (small) would do fine.
>
>
> So I was trying to prepare the following patch:
>
> <insert>
> merge: do not recommend to use -C if -c would do when aborting
>
> diff --git a/mercurial/merge.py b/mercurial/merge.py
> --- a/mercurial/merge.py
> +++ b/mercurial/merge.py
> @@ -444,7 +444,7 @@
>                     raise util.Abort(_("crosses branches (use 'hg merge' or
> "
>                                        "'hg update -C' to discard
> changes)"))
>                 raise util.Abort(_("crosses branches (use 'hg merge' "
> -                                   "or 'hg update -C')"))
> +                                   "or 'hg update -c')"))
>             elif wc.files() or wc.deleted():
>                 raise util.Abort(_("crosses named branches (use "
>                                    "'hg update -C' to discard changes)"))
> </insert>
>
>
> Then I ran the testsuite and came across test-merge5, which in
> my book has as a rather questionable history.
>
>
> In 6aa4a3fa4e60, Matt changed test-merge5 as follows:
>
> <insert>
> update: no -C needed to switch branches without outstanding changes
>
> diff --git a/tests/test-merge5 b/tests/test-merge5
> --- a/tests/test-merge5
> +++ b/tests/test-merge5
> @@ -12,9 +12,14 @@ hg commit -m"comment #1" -d "1000000 0"
>  hg update 0
>  rm b
>  hg commit -A -m"comment #2" -d "1000000 0"
> +mv a c
>  # in theory, we shouldn't need the "-y" below, but it prevents
>  # this test from hanging when "hg update" erroneously prompts the
>  # user for "keep or delete"
> +echo % should abort
> +hg update -y 1
> +mv c a
> +echo % should succeed
>  hg update -y 1
>
>  exit 0
> diff --git a/tests/test-merge5.out b/tests/test-merge5.out
> --- a/tests/test-merge5.out
> +++ b/tests/test-merge5.out
> @@ -1,4 +1,7 @@
>  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
>  removing b
>  created new head
> +% should abort
>  abort: update spans branches, use 'hg merge' or 'hg update -C' to lose
> changes
> +% should succeed
> +1 files updated, 0 files merged, 0 files removed, 0 files unresolved
> </insert>
>
>
> So that change specifically introduced a test to check that update succeeds
> without specifying -C in that case.
>
>
> But in later cdc458b12f0f, Matt changed test-merge5.out as follows:
>
> <insert>
> diff --git a/tests/test-merge5.out b/tests/test-merge5.out
> --- a/tests/test-merge5.out
> +++ b/tests/test-merge5.out
> @@ -2,6 +2,6 @@ 1 files updated, 0 files merged, 0 files
>  removing b
>  created new head
>  % should abort
> -abort: update spans branches, use 'hg merge' or 'hg update -C' to lose
> changes
> +abort: crosses branches (use 'hg merge' or 'hg update -C' to discard
> changes)
>  % should succeed
> -1 files updated, 0 files merged, 0 files removed, 0 files unresolved
> +abort: crosses branches (use 'hg merge'or 'hg update -C')
> </insert>
>
>
> Notice that the "should succeed" does *not* succeed: it produces
> an abort, and thus exactly fails the test that was introduced
> in 6aa4a3fa4e60.
>
>
> Currently we have the new-ish option -c which seems to help exactly
> in that case, namely allow an update to another head in the
> same named branch if there are no local modifications.
>
>
> Question is: is test-merge5 and test-merge5.out correct?
>
> In other words: should test-merge5 be updated to match its output,
> or is the output wrong?
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
>

--0016364d215fb02e110473c164b8
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

This is related to a series of patch from Stuart Marks one month ago, about=
 being able<br>to update without option flag from a clean work tree:<br><a =
href=3D"http://www.selenic.com/pipermail/mercurial-devel/2009-August/014835=
.html">http://www.selenic.com/pipermail/mercurial-devel/2009-August/014835.=
html</a><br>
<br>From the history, I think this was possible before cdc458b12f0f, but Ma=
tt then<br>changed the logic, but did not update the comment in the output,=
 so that the test<br>is correct with the current logic (no update crossing =
heads of the same branch),<br>
but the comment is wrong.<br><br>I would like Matt and the crew to look aga=
in at the inclusion of Stuart patch series<br>to get update from a clean wo=
rk tree between any heads working without any -c or -C.<br><br>Then, the la=
st update in test-merge5 will succeed again.<br>
<br>Regards.<br>Gilles.<br><br><div class=3D"gmail_quote">On Wed, Sep 16, 2=
009 at 1:07 AM, Adrian Buehlmann <span dir=3D"ltr">&lt;<a href=3D"mailto:ad=
rian at cadifra.com">adrian at cadifra.com</a>&gt;</span> wrote:<br><blockquote c=
lass=3D"gmail_quote" style=3D"border-left: 1px solid rgb(204, 204, 204); ma=
rgin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Matt and list<br>
<br>
Today I ran across the problem that I had to specify -c in<br>
order to be able to update from one head to another.<br>
<br>
I noticed that the error message I get without -c seems<br>
not quite correct, as mercurial recommends to use -C (big)<br>
even though -c (small) would do fine.<br>
<br>
<br>
So I was trying to prepare the following patch:<br>
<br>
&lt;insert&gt;<br>
merge: do not recommend to use -C if -c would do when aborting<br>
<br>
diff --git a/mercurial/merge.py b/mercurial/merge.py<br>
--- a/mercurial/merge.py<br>
+++ b/mercurial/merge.py<br>
@@ -444,7 +444,7 @@<br>
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 raise util.Abort(_(&quot;crosses b=
ranches (use &#39;hg merge&#39; or &quot;<br>
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0&quot;&#39;hg update -C&#39; to discard changes)&quot;))<br>
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 raise util.Abort(_(&quot;crosses branches =
(use &#39;hg merge&#39; &quot;<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 &quot=
;or &#39;hg update -C&#39;)&quot;))<br>
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 &quot=
;or &#39;hg update -c&#39;)&quot;))<br>
 =A0 =A0 =A0 =A0 =A0 =A0 elif wc.files() or wc.deleted():<br>
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 raise util.Abort(_(&quot;crosses named bra=
nches (use &quot;<br>
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0&qu=
ot;&#39;hg update -C&#39; to discard changes)&quot;))<br>
&lt;/insert&gt;<br>
<br>
<br>
Then I ran the testsuite and came across test-merge5, which in<br>
my book has as a rather questionable history.<br>
<br>
<br>
In 6aa4a3fa4e60, Matt changed test-merge5 as follows:<br>
<br>
&lt;insert&gt;<br>
update: no -C needed to switch branches without outstanding changes<br>
<br>
diff --git a/tests/test-merge5 b/tests/test-merge5<br>
--- a/tests/test-merge5<br>
+++ b/tests/test-merge5<br>
@@ -12,9 +12,14 @@ hg commit -m&quot;comment #1&quot; -d &quot;1000000 0&qu=
ot;<br>
=A0hg update 0<br>
=A0rm b<br>
=A0hg commit -A -m&quot;comment #2&quot; -d &quot;1000000 0&quot;<br>
+mv a c<br>
=A0# in theory, we shouldn&#39;t need the &quot;-y&quot; below, but it prev=
ents<br>
=A0# this test from hanging when &quot;hg update&quot; erroneously prompts =
the<br>
=A0# user for &quot;keep or delete&quot;<br>
+echo % should abort<br>
+hg update -y 1<br>
+mv c a<br>
+echo % should succeed<br>
=A0hg update -y 1<br>
<br>
=A0exit 0<br>
diff --git a/tests/test-merge5.out b/tests/test-merge5.out<br>
--- a/tests/test-merge5.out<br>
+++ b/tests/test-merge5.out<br>
@@ -1,4 +1,7 @@<br>
=A01 files updated, 0 files merged, 0 files removed, 0 files unresolved<br>
=A0removing b<br>
=A0created new head<br>
+% should abort<br>
=A0abort: update spans branches, use &#39;hg merge&#39; or &#39;hg update -=
C&#39; to lose changes<br>
+% should succeed<br>
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved<br>
&lt;/insert&gt;<br>
<br>
<br>
So that change specifically introduced a test to check that update succeeds=
<br>
without specifying -C in that case.<br>
<br>
<br>
But in later cdc458b12f0f, Matt changed test-merge5.out as follows:<br>
<br>
&lt;insert&gt;<br>
diff --git a/tests/test-merge5.out b/tests/test-merge5.out<br>
--- a/tests/test-merge5.out<br>
+++ b/tests/test-merge5.out<br>
@@ -2,6 +2,6 @@ 1 files updated, 0 files merged, 0 files<br>
=A0removing b<br>
=A0created new head<br>
=A0% should abort<br>
-abort: update spans branches, use &#39;hg merge&#39; or &#39;hg update -C&=
#39; to lose changes<br>
+abort: crosses branches (use &#39;hg merge&#39; or &#39;hg update -C&#39; =
to discard changes)<br>
=A0% should succeed<br>
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved<br>
+abort: crosses branches (use &#39;hg merge&#39;or &#39;hg update -C&#39;)<=
br>
&lt;/insert&gt;<br>
<br>
<br>
Notice that the &quot;should succeed&quot; does *not* succeed: it produces<=
br>
an abort, and thus exactly fails the test that was introduced<br>
in 6aa4a3fa4e60.<br>
<br>
<br>
Currently we have the new-ish option -c which seems to help exactly<br>
in that case, namely allow an update to another head in the<br>
same named branch if there are no local modifications.<br>
<br>
<br>
Question is: is test-merge5 and test-merge5.out correct?<br>
<br>
In other words: should test-merge5 be updated to match its output,<br>
or is the output wrong?<br>
_______________________________________________<br>
Mercurial-devel mailing list<br>
<a href=3D"mailto:Mercurial-devel at selenic.com">Mercurial-devel at selenic.com<=
/a><br>
<a href=3D"http://selenic.com/mailman/listinfo/mercurial-devel" target=3D"_=
blank">http://selenic.com/mailman/listinfo/mercurial-devel</a><br>
</blockquote></div><br>

--0016364d215fb02e110473c164b8--


More information about the Mercurial-devel mailing list