Patchwork rebase: always pass destination as revnum to _handleskippingobsolete()

login
register
mail settings
Submitter via Mercurial-devel
Date June 30, 2017, 3:44 p.m.
Message ID <a208aeb89f5e970a9c14.1498837497@martinvonz.svl.corp.google.com>
Download mbox | patch
Permalink /patch/21850/
State Accepted
Headers show

Comments

via Mercurial-devel - June 30, 2017, 3:44 p.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1498686834 25200
#      Wed Jun 28 14:53:54 2017 -0700
# Node ID a208aeb89f5e970a9c141e37fbbcb44702f6d899
# Parent  a1a952b5bb4fe903a0c00ed10ab15a78b9cb6cc7
rebase: always pass destination as revnum to _handleskippingobsolete()

We were passing it as a revision number in one place and as a context
in another. It worked because the only use was in "repo[dest].rev()",
but it was confusing. By always passing a revision number, we can also
remove that unnecessary lookup.
Jun Wu - June 30, 2017, 3:48 p.m.
Looks good to me. Thanks for splitting out the change!

Excerpts from Martin von Zweigbergk's message of 2017-06-30 08:44:57 -0700:
> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz@google.com>
> # Date 1498686834 25200
> #      Wed Jun 28 14:53:54 2017 -0700
> # Node ID a208aeb89f5e970a9c141e37fbbcb44702f6d899
> # Parent  a1a952b5bb4fe903a0c00ed10ab15a78b9cb6cc7
> rebase: always pass destination as revnum to _handleskippingobsolete()
> 
> We were passing it as a revision number in one place and as a context
> in another. It worked because the only use was in "repo[dest].rev()",
> but it was confusing. By always passing a revision number, we can also
> remove that unnecessary lookup.
> 
> diff --git a/hgext/rebase.py b/hgext/rebase.py
> --- a/hgext/rebase.py
> +++ b/hgext/rebase.py
> @@ -316,7 +316,7 @@
>                  hint=_('use --keep to keep original changesets'))
>  
>          obsrevs = _filterobsoleterevs(self.repo, set(rebaseset))
> -        self._handleskippingobsolete(rebaseset, obsrevs, dest)
> +        self._handleskippingobsolete(rebaseset, obsrevs, dest.rev())
>  
>          result = buildstate(self.repo, dest, rebaseset, self.collapsef,
>                              self.obsoletenotrebased)
> @@ -1483,7 +1483,7 @@
>      if allsuccessors:
>          # Look for successors of obsolete nodes to be rebased among
>          # the ancestors of dest
> -        ancs = cl.ancestors([repo[dest].rev()],
> +        ancs = cl.ancestors([dest],
>                              stoprev=min(allsuccessors),
>                              inclusive=True)
>          for s in allsuccessors:
Yuya Nishihara - July 1, 2017, 1:38 a.m.
On Fri, 30 Jun 2017 08:44:57 -0700, Martin von Zweigbergk via Mercurial-devel wrote:
> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz@google.com>
> # Date 1498686834 25200
> #      Wed Jun 28 14:53:54 2017 -0700
> # Node ID a208aeb89f5e970a9c141e37fbbcb44702f6d899
> # Parent  a1a952b5bb4fe903a0c00ed10ab15a78b9cb6cc7
> rebase: always pass destination as revnum to _handleskippingobsolete()

Queued, thanks.

Patch

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -316,7 +316,7 @@ 
                 hint=_('use --keep to keep original changesets'))
 
         obsrevs = _filterobsoleterevs(self.repo, set(rebaseset))
-        self._handleskippingobsolete(rebaseset, obsrevs, dest)
+        self._handleskippingobsolete(rebaseset, obsrevs, dest.rev())
 
         result = buildstate(self.repo, dest, rebaseset, self.collapsef,
                             self.obsoletenotrebased)
@@ -1483,7 +1483,7 @@ 
     if allsuccessors:
         # Look for successors of obsolete nodes to be rebased among
         # the ancestors of dest
-        ancs = cl.ancestors([repo[dest].rev()],
+        ancs = cl.ancestors([dest],
                             stoprev=min(allsuccessors),
                             inclusive=True)
         for s in allsuccessors: