Patchwork [evolve-ext] inhibit: don't inhibit pinned commits during rebase

login
register
mail settings
Submitter Durham Goode
Date May 5, 2015, 8:34 p.m.
Message ID <09cef013958f3057ca23.1430858045@dev2000.prn2.facebook.com>
Download mbox | patch
Permalink /patch/8906/
State Accepted
Headers show

Comments

Durham Goode - May 5, 2015, 8:34 p.m.
# HG changeset patch
# User Durham Goode <durham@fb.com>
# Date 1430857921 25200
#      Tue May 05 13:32:01 2015 -0700
# Node ID 09cef013958f3057ca235803d544ea8eafdc6702
# Parent  ebcf23fe3032e551a220eade3fe27af7d44c8d93
inhibit: don't inhibit pinned commits during rebase

During a rebase we pin certain commits to always be visible. This caused the
inhibit extension to inhibit them when a transaction closed. Let's make inhibit
aware of such pins and not obsolete them.
Pierre-Yves David - May 5, 2015, 10:26 p.m.
On 05/05/2015 01:34 PM, Durham Goode wrote:
> # HG changeset patch
> # User Durham Goode <durham@fb.com>
> # Date 1430857921 25200
> #      Tue May 05 13:32:01 2015 -0700
> # Node ID 09cef013958f3057ca235803d544ea8eafdc6702
> # Parent  ebcf23fe3032e551a220eade3fe27af7d44c8d93
> inhibit: don't inhibit pinned commits during rebase
>
> During a rebase we pin certain commits to always be visible. This caused the
> inhibit extension to inhibit them when a transaction closed. Let's make inhibit
> aware of such pins and not obsolete them.
>
> diff --git a/hgext/inhibit.py b/hgext/inhibit.py
> --- a/hgext/inhibit.py
> +++ b/hgext/inhibit.py
> @@ -174,6 +174,8 @@ def transactioncallback(orig, repo, *arg
>           # At the end of the transaction we catch all the new visible and
>           # obsolete commit to inhibit them
>           visibleobsolete = repo.revs('(not hidden()) and obsolete()')
> +        ignoreset = set(getattr(repo, '_rebaseset', []))
> +        visibleobsolete = list(r for r in visibleobsolete if r not in ignoreset)

should be

   visibleobsolete = [r for r in visibleobsolete if r not in ignoreset]

(will fix it in flight once I got a reply on the other question

>           if visibleobsolete:
>               _inhibitmarkers(repo, [repo[r].node() for r in visibleobsolete])
>       transaction = orig(repo, *args, **kwargs)
> diff --git a/tests/test-inhibit.t b/tests/test-inhibit.t
> --- a/tests/test-inhibit.t
> +++ b/tests/test-inhibit.t
> @@ -405,20 +405,16 @@ With severals hidden sha, rebase of one
>     |
>     o  12:fe1634cbe235 add cK
>     |
> -  | o  11:53a94305e133 add cL
> +  | @  9:55c73a90e4b4 add cJ
>     | |
> -  | o  10:ad78ff7d621f add cK
> +  | | o  7:18214586bf78 add cJ
> +  | |/
> +  | o  6:cf5c4f4554ce add cH
>     | |
> -  | | @  9:55c73a90e4b4 add cJ
> -  | | |
> -  | | | o  7:18214586bf78 add cJ
> -  | | |/
> -  | | o  6:cf5c4f4554ce add cH
> -  | | |
> -  | | o  5:5419eb264a33 add cG
> -  | | |
> -  | | o  4:98065434e5c6 add cE
> -  | |/
> +  | o  5:5419eb264a33 add cG
> +  | |
> +  | o  4:98065434e5c6 add cE
> +  | |
>     o |  3:2db36d8066ff add cD
>     | |
>     o |  2:7df62a38b9bf add cC
> @@ -431,8 +427,6 @@ Check that amending in the middle of a s
>
>     $ hg prune 1::
>     5 changesets pruned
> -  $ hg prune 10::
> -  2 changesets pruned

What was this line about? Just fixing the rebase issue?
Durham Goode - May 6, 2015, 12:23 a.m.
On 5/5/15, 3:26 PM, "Pierre-Yves David" <pierre-yves.david@ens-lyon.org>
wrote:

>
>
>On 05/05/2015 01:34 PM, Durham Goode wrote:
>> # HG changeset patch
>> # User Durham Goode <durham@fb.com>
>> # Date 1430857921 25200
>> #      Tue May 05 13:32:01 2015 -0700
>> # Node ID 09cef013958f3057ca235803d544ea8eafdc6702
>> # Parent  ebcf23fe3032e551a220eade3fe27af7d44c8d93
>> inhibit: don't inhibit pinned commits during rebase
>>
>> During a rebase we pin certain commits to always be visible. This
>>caused the
>> inhibit extension to inhibit them when a transaction closed. Let's make
>>inhibit
>> aware of such pins and not obsolete them.
>>
>> diff --git a/hgext/inhibit.py b/hgext/inhibit.py
>> --- a/hgext/inhibit.py
>> +++ b/hgext/inhibit.py
>> @@ -174,6 +174,8 @@ def transactioncallback(orig, repo, *arg
>>           # At the end of the transaction we catch all the new visible
>>and
>>           # obsolete commit to inhibit them
>>           visibleobsolete = repo.revs('(not hidden()) and obsolete()')
>> +        ignoreset = set(getattr(repo, '_rebaseset', []))
>> +        visibleobsolete = list(r for r in visibleobsolete if r not in
>>ignoreset)
>
>should be
>
>   visibleobsolete = [r for r in visibleobsolete if r not in ignoreset]
>
>(will fix it in flight once I got a reply on the other question
>
>>           if visibleobsolete:
>>               _inhibitmarkers(repo, [repo[r].node() for r in
>>visibleobsolete])
>>       transaction = orig(repo, *args, **kwargs)
>> diff --git a/tests/test-inhibit.t b/tests/test-inhibit.t
>> --- a/tests/test-inhibit.t
>> +++ b/tests/test-inhibit.t
>> @@ -405,20 +405,16 @@ With severals hidden sha, rebase of one
>>     |
>>     o  12:fe1634cbe235 add cK
>>     |
>> -  | o  11:53a94305e133 add cL
>> +  | @  9:55c73a90e4b4 add cJ
>>     | |
>> -  | o  10:ad78ff7d621f add cK
>> +  | | o  7:18214586bf78 add cJ
>> +  | |/
>> +  | o  6:cf5c4f4554ce add cH
>>     | |
>> -  | | @  9:55c73a90e4b4 add cJ
>> -  | | |
>> -  | | | o  7:18214586bf78 add cJ
>> -  | | |/
>> -  | | o  6:cf5c4f4554ce add cH
>> -  | | |
>> -  | | o  5:5419eb264a33 add cG
>> -  | | |
>> -  | | o  4:98065434e5c6 add cE
>> -  | |/
>> +  | o  5:5419eb264a33 add cG
>> +  | |
>> +  | o  4:98065434e5c6 add cE
>> +  | |
>>     o |  3:2db36d8066ff add cD
>>     | |
>>     o |  2:7df62a38b9bf add cC
>> @@ -431,8 +427,6 @@ Check that amending in the middle of a s
>>
>>     $ hg prune 1::
>>     5 changesets pruned
>> -  $ hg prune 10::
>> -  2 changesets pruned
>
>What was this line about? Just fixing the rebase issue?

The test that changed in 405 was because commits 10 and 11 no longer
existed after the rebase (so the test is now right).  This line down here
was to manually delete 10 and 11, which is no longer necessary.
Pierre-Yves David - May 6, 2015, 12:26 a.m.
On 05/05/2015 05:23 PM, Durham Goode wrote:
>
>
> On 5/5/15, 3:26 PM, "Pierre-Yves David" <pierre-yves.david@ens-lyon.org>
> wrote:
>
>>
>>
>> On 05/05/2015 01:34 PM, Durham Goode wrote:
>>> # HG changeset patch
>>> # User Durham Goode <durham@fb.com>
>>> # Date 1430857921 25200
>>> #      Tue May 05 13:32:01 2015 -0700
>>> # Node ID 09cef013958f3057ca235803d544ea8eafdc6702
>>> # Parent  ebcf23fe3032e551a220eade3fe27af7d44c8d93
>>> inhibit: don't inhibit pinned commits during rebase

pushed to the evolve repo, thanks.

Patch

diff --git a/hgext/inhibit.py b/hgext/inhibit.py
--- a/hgext/inhibit.py
+++ b/hgext/inhibit.py
@@ -174,6 +174,8 @@  def transactioncallback(orig, repo, *arg
         # At the end of the transaction we catch all the new visible and
         # obsolete commit to inhibit them
         visibleobsolete = repo.revs('(not hidden()) and obsolete()')
+        ignoreset = set(getattr(repo, '_rebaseset', []))
+        visibleobsolete = list(r for r in visibleobsolete if r not in ignoreset)
         if visibleobsolete:
             _inhibitmarkers(repo, [repo[r].node() for r in visibleobsolete])
     transaction = orig(repo, *args, **kwargs)
diff --git a/tests/test-inhibit.t b/tests/test-inhibit.t
--- a/tests/test-inhibit.t
+++ b/tests/test-inhibit.t
@@ -405,20 +405,16 @@  With severals hidden sha, rebase of one 
   |
   o  12:fe1634cbe235 add cK
   |
-  | o  11:53a94305e133 add cL
+  | @  9:55c73a90e4b4 add cJ
   | |
-  | o  10:ad78ff7d621f add cK
+  | | o  7:18214586bf78 add cJ
+  | |/
+  | o  6:cf5c4f4554ce add cH
   | |
-  | | @  9:55c73a90e4b4 add cJ
-  | | |
-  | | | o  7:18214586bf78 add cJ
-  | | |/
-  | | o  6:cf5c4f4554ce add cH
-  | | |
-  | | o  5:5419eb264a33 add cG
-  | | |
-  | | o  4:98065434e5c6 add cE
-  | |/
+  | o  5:5419eb264a33 add cG
+  | |
+  | o  4:98065434e5c6 add cE
+  | |
   o |  3:2db36d8066ff add cD
   | |
   o |  2:7df62a38b9bf add cC
@@ -431,8 +427,6 @@  Check that amending in the middle of a s
 
   $ hg prune 1::
   5 changesets pruned
-  $ hg prune 10::
-  2 changesets pruned
   $ hg log -G
   @  9:55c73a90e4b4 add cJ
   |