Patchwork [3,of,3,V2] rebase: unhide original working directory node as well (issue5219)

login
register
mail settings
Submitter via Mercurial-devel
Date March 11, 2017, 7:28 a.m.
Message ID <b8c437230731d53a6c16.1489217334@martinvonz.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/19096/
State Accepted
Headers show

Comments

via Mercurial-devel - March 11, 2017, 7:28 a.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1489216040 28800
#      Fri Mar 10 23:07:20 2017 -0800
# Node ID b8c437230731d53a6c165567a6fff1a1467f4107
# Parent  c946c7aa259ca97d5ca88238df0bb6e61d6b6313
rebase: unhide original working directory node as well (issue5219)

By including the working directory revision at the start of rebase in
the repo._rebaseset, we make sure it's not hidden when we update back
to it at the end of the rebase.

This feels like abusing the set a bit given its name (_rebaseset), but
I couldn't think of another name that's clearly better.
Pierre-Yves David - March 11, 2017, 5:56 p.m.
On 03/10/2017 11:28 PM, Martin von Zweigbergk via Mercurial-devel wrote:
> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz@google.com>
> # Date 1489216040 28800
> #      Fri Mar 10 23:07:20 2017 -0800
> # Node ID b8c437230731d53a6c165567a6fff1a1467f4107
> # Parent  c946c7aa259ca97d5ca88238df0bb6e61d6b6313
> rebase: unhide original working directory node as well (issue5219)
>
> By including the working directory revision at the start of rebase in
> the repo._rebaseset, we make sure it's not hidden when we update back
> to it at the end of the rebase.
>
> This feels like abusing the set a bit given its name (_rebaseset), but
> I couldn't think of another name that's clearly better.

That looks good to me, thanks.
Yuya Nishihara - March 11, 2017, 6:22 p.m.
On Sat, 11 Mar 2017 09:56:17 -0800, Pierre-Yves David wrote:
> 
> On 03/10/2017 11:28 PM, Martin von Zweigbergk via Mercurial-devel wrote:
> > # HG changeset patch
> > # User Martin von Zweigbergk <martinvonz@google.com>
> > # Date 1489216040 28800
> > #      Fri Mar 10 23:07:20 2017 -0800
> > # Node ID b8c437230731d53a6c165567a6fff1a1467f4107
> > # Parent  c946c7aa259ca97d5ca88238df0bb6e61d6b6313
> > rebase: unhide original working directory node as well (issue5219)
> >
> > By including the working directory revision at the start of rebase in
> > the repo._rebaseset, we make sure it's not hidden when we update back
> > to it at the end of the rebase.
> >
> > This feels like abusing the set a bit given its name (_rebaseset), but
> > I couldn't think of another name that's clearly better.
> 
> That looks good to me, thanks.

Replaced set literal with set([]) for Py2.6 and queued, thanks.
Augie Fackler - March 11, 2017, 6:31 p.m.
On Fri, Mar 10, 2017 at 11:28:54PM -0800, Martin von Zweigbergk via Mercurial-devel wrote:
> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz@google.com>
> # Date 1489216040 28800
> #      Fri Mar 10 23:07:20 2017 -0800
> # Node ID b8c437230731d53a6c165567a6fff1a1467f4107
> # Parent  c946c7aa259ca97d5ca88238df0bb6e61d6b6313
> rebase: unhide original working directory node as well (issue5219)

Queued these, thanks

>
> By including the working directory revision at the start of rebase in
> the repo._rebaseset, we make sure it's not hidden when we update back
> to it at the end of the rebase.
>
> This feels like abusing the set a bit given its name (_rebaseset), but
> I couldn't think of another name that's clearly better.
>
> diff -r c946c7aa259c -r b8c437230731 hgext/rebase.py
> --- a/hgext/rebase.py	Fri Mar 10 23:06:31 2017 -0800
> +++ b/hgext/rebase.py	Fri Mar 10 23:07:20 2017 -0800
> @@ -250,7 +250,7 @@
>          repo.ui.debug('computed skipped revs: %s\n' %
>                          (' '.join(str(r) for r in sorted(skipped)) or None))
>          repo.ui.debug('rebase status resumed\n')
> -        _setrebasesetvisibility(repo, set(state.keys()))
> +        _setrebasesetvisibility(repo, set(state.keys()) | {originalwd})
>
>          self.originalwd = originalwd
>          self.target = target
> @@ -1203,7 +1203,8 @@
>      dest: context
>      rebaseset: set of rev
>      '''
> -    _setrebasesetvisibility(repo, set(rebaseset))
> +    originalwd = repo['.'].rev()
> +    _setrebasesetvisibility(repo, set(rebaseset) | {originalwd})
>
>      # This check isn't strictly necessary, since mq detects commits over an
>      # applied patch. But it prevents messing up the working directory when
> @@ -1288,7 +1289,7 @@
>              state[r] = revpruned
>          else:
>              state[r] = revprecursor
> -    return repo['.'].rev(), dest.rev(), state
> +    return originalwd, dest.rev(), state
>
>  def clearrebased(ui, repo, state, skipped, collapsedas=None):
>      """dispose of rebased revision at the end of the rebase
> diff -r c946c7aa259c -r b8c437230731 tests/test-rebase-obsolete.t
> --- a/tests/test-rebase-obsolete.t	Fri Mar 10 23:06:31 2017 -0800
> +++ b/tests/test-rebase-obsolete.t	Fri Mar 10 23:07:20 2017 -0800
> @@ -279,11 +279,27 @@
>    $ hg --hidden up -qr 'first(hidden())'
>    $ hg rebase --rev 13 --dest 15
>    rebasing 13:98f6af4ee953 "C"
> -  transaction abort!
> -  rollback completed
> -  abort: hidden revision '1'!
> -  (use --hidden to access hidden revisions)
> -  [255]
> +  $ hg log -G
> +  o  16:294a2b93eb4d C
> +  |
> +  o  15:627d46148090 D
> +  |
> +  | o  12:462a34d07e59 B
> +  | |
> +  | o  11:4596109a6a43 D
> +  | |
> +  | o  7:02de42196ebe H
> +  | |
> +  +---o  6:eea13746799a G
> +  | |/
> +  | o  5:24b6387c8c8c F
> +  | |
> +  o |  4:9520eea781bc E
> +  |/
> +  | @  1:42ccdea3bb16 B
> +  |/
> +  o  0:cd010b8cd998 A
> +
>
>    $ cd ..
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Augie Fackler - March 11, 2017, 6:45 p.m.
On Sat, Mar 11, 2017 at 10:22:14AM -0800, Yuya Nishihara wrote:
> On Sat, 11 Mar 2017 09:56:17 -0800, Pierre-Yves David wrote:
> >
> > On 03/10/2017 11:28 PM, Martin von Zweigbergk via Mercurial-devel wrote:
> > > # HG changeset patch
> > > # User Martin von Zweigbergk <martinvonz@google.com>
> > > # Date 1489216040 28800
> > > #      Fri Mar 10 23:07:20 2017 -0800
> > > # Node ID b8c437230731d53a6c165567a6fff1a1467f4107
> > > # Parent  c946c7aa259ca97d5ca88238df0bb6e61d6b6313
> > > rebase: unhide original working directory node as well (issue5219)
> > >
> > > By including the working directory revision at the start of rebase in
> > > the repo._rebaseset, we make sure it's not hidden when we update back
> > > to it at the end of the rebase.
> > >
> > > This feels like abusing the set a bit given its name (_rebaseset), but
> > > I couldn't think of another name that's clearly better.
> >
> > That looks good to me, thanks.
>
> Replaced set literal with set([]) for Py2.6 and queued, thanks.

D'oh. Good eye. Mark your fixed version as obsoleting mine? Thanks!

> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Yuya Nishihara - March 11, 2017, 6:51 p.m.
On Sat, 11 Mar 2017 13:45:19 -0500, Augie Fackler wrote:
> On Sat, Mar 11, 2017 at 10:22:14AM -0800, Yuya Nishihara wrote:
> > On Sat, 11 Mar 2017 09:56:17 -0800, Pierre-Yves David wrote:
> > >
> > > On 03/10/2017 11:28 PM, Martin von Zweigbergk via Mercurial-devel wrote:
> > > > # HG changeset patch
> > > > # User Martin von Zweigbergk <martinvonz@google.com>
> > > > # Date 1489216040 28800
> > > > #      Fri Mar 10 23:07:20 2017 -0800
> > > > # Node ID b8c437230731d53a6c165567a6fff1a1467f4107
> > > > # Parent  c946c7aa259ca97d5ca88238df0bb6e61d6b6313
> > > > rebase: unhide original working directory node as well (issue5219)
> > > >
> > > > By including the working directory revision at the start of rebase in
> > > > the repo._rebaseset, we make sure it's not hidden when we update back
> > > > to it at the end of the rebase.
> > > >
> > > > This feels like abusing the set a bit given its name (_rebaseset), but
> > > > I couldn't think of another name that's clearly better.
> > >
> > > That looks good to me, thanks.
> >
> > Replaced set literal with set([]) for Py2.6 and queued, thanks.
> 
> D'oh. Good eye. Mark your fixed version as obsoleting mine? Thanks!

Done. Pushed mine.
via Mercurial-devel - March 11, 2017, 6:51 p.m.
On Sat, Mar 11, 2017 at 10:45 AM, Augie Fackler <raf@durin42.com> wrote:
> On Sat, Mar 11, 2017 at 10:22:14AM -0800, Yuya Nishihara wrote:
>> On Sat, 11 Mar 2017 09:56:17 -0800, Pierre-Yves David wrote:
>> >
>> > On 03/10/2017 11:28 PM, Martin von Zweigbergk via Mercurial-devel wrote:
>> > > # HG changeset patch
>> > > # User Martin von Zweigbergk <martinvonz@google.com>
>> > > # Date 1489216040 28800
>> > > #      Fri Mar 10 23:07:20 2017 -0800
>> > > # Node ID b8c437230731d53a6c165567a6fff1a1467f4107
>> > > # Parent  c946c7aa259ca97d5ca88238df0bb6e61d6b6313
>> > > rebase: unhide original working directory node as well (issue5219)
>> > >
>> > > By including the working directory revision at the start of rebase in
>> > > the repo._rebaseset, we make sure it's not hidden when we update back
>> > > to it at the end of the rebase.
>> > >
>> > > This feels like abusing the set a bit given its name (_rebaseset), but
>> > > I couldn't think of another name that's clearly better.
>> >
>> > That looks good to me, thanks.
>>
>> Replaced set literal with set([]) for Py2.6 and queued, thanks.
>
> D'oh. Good eye. Mark your fixed version as obsoleting mine? Thanks!

Oh, sorry, I thought we were on Py2.7. I had noticed earlier that
fsmonitor and watchman use set literals. I guess we just don't promise
2.6 compatibility for extensions?

>
>> _______________________________________________
>> Mercurial-devel mailing list
>> Mercurial-devel@mercurial-scm.org
>> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Patch

diff -r c946c7aa259c -r b8c437230731 hgext/rebase.py
--- a/hgext/rebase.py	Fri Mar 10 23:06:31 2017 -0800
+++ b/hgext/rebase.py	Fri Mar 10 23:07:20 2017 -0800
@@ -250,7 +250,7 @@ 
         repo.ui.debug('computed skipped revs: %s\n' %
                         (' '.join(str(r) for r in sorted(skipped)) or None))
         repo.ui.debug('rebase status resumed\n')
-        _setrebasesetvisibility(repo, set(state.keys()))
+        _setrebasesetvisibility(repo, set(state.keys()) | {originalwd})
 
         self.originalwd = originalwd
         self.target = target
@@ -1203,7 +1203,8 @@ 
     dest: context
     rebaseset: set of rev
     '''
-    _setrebasesetvisibility(repo, set(rebaseset))
+    originalwd = repo['.'].rev()
+    _setrebasesetvisibility(repo, set(rebaseset) | {originalwd})
 
     # This check isn't strictly necessary, since mq detects commits over an
     # applied patch. But it prevents messing up the working directory when
@@ -1288,7 +1289,7 @@ 
             state[r] = revpruned
         else:
             state[r] = revprecursor
-    return repo['.'].rev(), dest.rev(), state
+    return originalwd, dest.rev(), state
 
 def clearrebased(ui, repo, state, skipped, collapsedas=None):
     """dispose of rebased revision at the end of the rebase
diff -r c946c7aa259c -r b8c437230731 tests/test-rebase-obsolete.t
--- a/tests/test-rebase-obsolete.t	Fri Mar 10 23:06:31 2017 -0800
+++ b/tests/test-rebase-obsolete.t	Fri Mar 10 23:07:20 2017 -0800
@@ -279,11 +279,27 @@ 
   $ hg --hidden up -qr 'first(hidden())'
   $ hg rebase --rev 13 --dest 15
   rebasing 13:98f6af4ee953 "C"
-  transaction abort!
-  rollback completed
-  abort: hidden revision '1'!
-  (use --hidden to access hidden revisions)
-  [255]
+  $ hg log -G
+  o  16:294a2b93eb4d C
+  |
+  o  15:627d46148090 D
+  |
+  | o  12:462a34d07e59 B
+  | |
+  | o  11:4596109a6a43 D
+  | |
+  | o  7:02de42196ebe H
+  | |
+  +---o  6:eea13746799a G
+  | |/
+  | o  5:24b6387c8c8c F
+  | |
+  o |  4:9520eea781bc E
+  |/
+  | @  1:42ccdea3bb16 B
+  |/
+  o  0:cd010b8cd998 A
+  
 
   $ cd ..