unclear test-merge5 and update -c
Stuart W. Marks
smarks at smarks.org
Fri Sep 18 01:35:09 CDT 2009
Gilles Moris wrote:
> This is related to a series of patch from Stuart Marks one month ago,
> about being able
> to update without option flag from a clean work tree:
> http://www.selenic.com/pipermail/mercurial-devel/2009-August/014835.html
>
> From the history, I think this was possible before cdc458b12f0f, but
> Matt 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.
Yes, I had noticed this issue with the mismatch between the comment and the
actual behavior in test-merge5. It turns out that this will be "fixed" by my
patch. Where the comment says "should succeed" it will actually succeed,
whereas it currently fails.
> 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.
Yes, that's right. Thanks for your support. I've updated the patch per your
comments from the last time I posted them, and I'll repost them shortly
(assuming all tests pass).
s'marks
>
> Regards.
> Gilles.
>
> On Wed, Sep 16, 2009 at 1:07 AM, Adrian Buehlmann <adrian at cadifra.com
> <mailto: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 <mailto:Mercurial-devel at selenic.com>
> http://selenic.com/mailman/listinfo/mercurial-devel
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
More information about the Mercurial-devel
mailing list