Patchwork [5,of,5] destutil: remove dead code about non-linear updates

login
register
mail settings
Submitter via Mercurial-devel
Date Feb. 10, 2017, 6 a.m.
Message ID <a85eff052c57bde4c610.1486706432@martinvonz.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/18390/
State Accepted
Delegated to: Sean Farley
Headers show

Comments

via Mercurial-devel - Feb. 10, 2017, 6 a.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1486501890 28800
#      Tue Feb 07 13:11:30 2017 -0800
# Node ID a85eff052c57bde4c6100a23888c471f595c2d85
# Parent  05ff0729e9f4166f1f08855d25aa6ed4dddf155b
destutil: remove dead code about non-linear updates

IIUC, the non-linear updates no longer happen by default since
6b1fc09c699a (update: change default destination to tipmost descendant
(issue4673) (BC), 2016-02-02), and it was only if they happened by
default that we used to error out, so there is no longer a need to
handle this case.
Yuya Nishihara - Feb. 12, 2017, 11:20 a.m.
On Thu, 09 Feb 2017 22:00:32 -0800, Martin von Zweigbergk via Mercurial-devel wrote:
> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz@google.com>
> # Date 1486501890 28800
> #      Tue Feb 07 13:11:30 2017 -0800
> # Node ID a85eff052c57bde4c6100a23888c471f595c2d85
> # Parent  05ff0729e9f4166f1f08855d25aa6ed4dddf155b
> destutil: remove dead code about non-linear updates
> 
> IIUC, the non-linear updates no longer happen by default since
> 6b1fc09c699a (update: change default destination to tipmost descendant
> (issue4673) (BC), 2016-02-02), and it was only if they happened by
> default that we used to error out, so there is no longer a need to
> handle this case.

The series looks good, and I see no logic errors. So queued, thanks.

> diff -r 05ff0729e9f4 -r a85eff052c57 mercurial/destutil.py
> --- a/mercurial/destutil.py	Thu Feb 09 09:55:31 2017 -0800
> +++ b/mercurial/destutil.py	Tue Feb 07 13:11:30 2017 -0800
> @@ -37,10 +37,6 @@
>                      hint = _("commit and merge, or update --clean to"
>                               " discard changes")
>                      raise error.UpdateAbort(msg, hint=hint)
> -                elif not check:  # destination is not a descendant.
> -                    msg = _("not a linear update")
> -                    hint = _("merge or update --check to force update")
> -                    raise error.UpdateAbort(msg, hint=hint)

Maybe we can get rid of 'check' argument as a follow up?
via Mercurial-devel - Feb. 12, 2017, 6:03 p.m.
On Feb 12, 2017 03:22, "Yuya Nishihara" <yuya@tcha.org> wrote:

On Thu, 09 Feb 2017 22:00:32 -0800, Martin von Zweigbergk via
Mercurial-devel wrote:
> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz@google.com>
> # Date 1486501890 28800
> #      Tue Feb 07 13:11:30 2017 -0800
> # Node ID a85eff052c57bde4c6100a23888c471f595c2d85
> # Parent  05ff0729e9f4166f1f08855d25aa6ed4dddf155b
> destutil: remove dead code about non-linear updates
>
> IIUC, the non-linear updates no longer happen by default since
> 6b1fc09c699a (update: change default destination to tipmost descendant
> (issue4673) (BC), 2016-02-02), and it was only if they happened by
> default that we used to error out, so there is no longer a need to
> handle this case.

The series looks good, and I see no logic errors. So queued, thanks.

> diff -r 05ff0729e9f4 -r a85eff052c57 mercurial/destutil.py
> --- a/mercurial/destutil.py   Thu Feb 09 09:55:31 2017 -0800
> +++ b/mercurial/destutil.py   Tue Feb 07 13:11:30 2017 -0800
> @@ -37,10 +37,6 @@
>                      hint = _("commit and merge, or update --clean to"
>                               " discard changes")
>                      raise error.UpdateAbort(msg, hint=hint)
> -                elif not check:  # destination is not a descendant.
> -                    msg = _("not a linear update")
> -                    hint = _("merge or update --check to force update")
> -                    raise error.UpdateAbort(msg, hint=hint)

Maybe we can get rid of 'check' argument as a follow up?


I have that patch in my repo, but I may even remove the function
completely, I haven't decided yet. This is part of a longer series to add
other actions than the current for what to do with a dirty working
directory in update. The current two actions are to about (--check) or to
merge if the update is linear and otherwise about (the default). I hope to
add one for merging whether or not it's linear (--merge, probably), and one
for merging as long as no files need merging (--check-no-conflict, or
hopefully something better. I also hope to add a config option for the
default.

Patch

diff -r 05ff0729e9f4 -r a85eff052c57 mercurial/destutil.py
--- a/mercurial/destutil.py	Thu Feb 09 09:55:31 2017 -0800
+++ b/mercurial/destutil.py	Tue Feb 07 13:11:30 2017 -0800
@@ -37,10 +37,6 @@ 
                     hint = _("commit and merge, or update --clean to"
                              " discard changes")
                     raise error.UpdateAbort(msg, hint=hint)
-                elif not check:  # destination is not a descendant.
-                    msg = _("not a linear update")
-                    hint = _("merge or update --check to force update")
-                    raise error.UpdateAbort(msg, hint=hint)
 
 def _destupdateobs(repo, clean, check):
     """decide of an update destination from obsolescence markers"""