[PATCH 2 of 3] update: allow branch crossing when clean

Adrian Buehlmann adrian at cadifra.com
Thu Sep 17 04:13:54 CDT 2009


On 20.08.2009 07:57, Stuart W Marks wrote:
> # HG changeset patch
> # User Stuart W Marks <smarks at smarks.org>
> # Date 1250742664 25200
> # Node ID 3154c4769de6ddf8372548939d458c7c087be0da
> # Parent  e0811a5c19f8c4788b997d6ebb0f0dc66f8d0436
> update: allow branch crossing when clean

Apologies for responding that late, but I was biten by that use case just
recently and I didn't have much motivation to look at your patches
yet (which is a pity).

Merge logic, however, is just a daunting subject I usually try to keep
away.

> Update will now allow crossing branches within the same named branch,
> if there are no uncommitted changes, without requiring the -c or -C
> option. Minor confirmation to abort message if uncommitted changes are
> found.

I will have to investigate this further. Sounds interesting. But see below.

> Add check to prevent both --check and --clean options from being given.
> Behavior was that --check was ignored, but specifying both is nonsensical
> and should be disallowed.

This part should be included as soon as possible. In an independent
small patch. See details below.

> Modify test-update-branches and output to reflect the altered case. Modify
> test-merge5.out to reflect the altered case. Modify
> test-update-local-change.out with new message.
> 
> diff -r e0811a5c19f8 -r 3154c4769de6 mercurial/commands.py
> --- a/mercurial/commands.py	Wed Aug 19 21:30:32 2009 -0700
> +++ b/mercurial/commands.py	Wed Aug 19 21:31:04 2009 -0700
> @@ -3049,6 +3049,10 @@
>      if not rev:
>          rev = node
>  
> +    if check and clean:
> +        raise util.Abort(_("cannot specify both --check and --clean "
> +                           "at the same time"))
> +

Maybe the text of the abort message could be a bit shorter. Proposal:

+    if check and clean:
+        raise util.Abort(_("can't specify both -C and -c"))
+

>      if not clean and check:
>          # we could use dirty() but we can ignore merge and branch trivia
>          c = repo[None]

IMHO, there was just too much change in one patch, which is probably one of the
reasons it was not further investigated by crew or Matt.

Could we have an uncontroversial isolated tiny patch just introducing the
abort for the -Cc case for now?



More information about the Mercurial-devel mailing list