Patchwork evolve: wrap setparents calls in begin/endparentchange

login
register
mail settings
Submitter Siddharth Agarwal
Date Sept. 17, 2014, 8:39 p.m.
Message ID <c3e23fbf7bd71300f195.1410986347@devbig136.prn2.facebook.com>
Download mbox | patch
Permalink /patch/5853/
State Accepted
Headers show

Comments

Siddharth Agarwal - Sept. 17, 2014, 8:39 p.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1410986304 25200
#      Wed Sep 17 13:38:24 2014 -0700
# Node ID c3e23fbf7bd71300f19522d583ab8fe50916b7f7
# Parent  6328e005b6c8f3f080bae829417ec195827165fb
evolve: wrap setparents calls in begin/endparentchange

Mercurial rev d259322a394b added a requirement to wrap any dirstate.setparents
calls and their associated dirstate changes in begin/endparentchange.
Siddharth Agarwal - Sept. 17, 2014, 8:39 p.m.
On 09/17/2014 01:39 PM, Siddharth Agarwal wrote:
> # HG changeset patch
> # User Siddharth Agarwal <sid0@fb.com>
> # Date 1410986304 25200
> #      Wed Sep 17 13:38:24 2014 -0700
> # Node ID c3e23fbf7bd71300f19522d583ab8fe50916b7f7
> # Parent  6328e005b6c8f3f080bae829417ec195827165fb
> evolve: wrap setparents calls in begin/endparentchange

Forgot to flag this [evolve].

>
> Mercurial rev d259322a394b added a requirement to wrap any dirstate.setparents
> calls and their associated dirstate changes in begin/endparentchange.
>
> diff --git a/hgext/evolve.py b/hgext/evolve.py
> --- a/hgext/evolve.py
> +++ b/hgext/evolve.py
> @@ -1451,7 +1451,9 @@
>       finally:
>           tr.release()
>       # reroute the working copy parent to the new changeset
> +    repo.dirstate.beginparentchange()
>       repo.dirstate.setparents(newid, node.nullid)
> +    repo.dirstate.endparentchange()
>   
>   def _solvedivergent(ui, repo, divergent, dryrun=False, confirm=False,
>                       progresscb=None):
> @@ -1539,7 +1541,9 @@
>       if progresscb: progresscb()
>       tr = repo.transaction('stabilize-divergent')
>       try:
> +        repo.dirstate.beginparentchange()
>           repo.dirstate.setparents(divergent.node(), node.nullid)
> +        repo.dirstate.endparentchange()
>           oldlen = len(repo)
>           amend(ui, repo, message='', logfile='')
>           if oldlen == len(repo):
> @@ -1988,8 +1992,10 @@
>           # Move local changes on filtered changeset
>           obsolete.createmarkers(repo, [(old, (repo[newid],))])
>           phases.retractboundary(repo, tr, oldphase, [newid])
> +        repo.dirstate.beginparentchange()
>           repo.dirstate.setparents(newid, node.nullid)
>           _uncommitdirstate(repo, old, match)
> +        repo.dirstate.endparentchange()
>           updatebookmarks(newid)
>           if not repo[newid].files():
>               ui.warn(_("new changeset is empty\n"))
> @@ -2075,7 +2081,9 @@
>                       obsolete.createmarkers(repo, [(ctx, (repo[new],))])
>                   phases.retractboundary(repo, tr, ctx.phase(), [new])
>                   if ctx in repo[None].parents():
> +                    repo.dirstate.beginparentchange()
>                       repo.dirstate.setparents(new, node.nullid)
> +                    repo.dirstate.endparentchange()
>               tr.close()
>           finally:
>               tr.release()
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
Pierre-Yves David - Sept. 17, 2014, 11:21 p.m.
On 09/17/2014 01:39 PM, Siddharth Agarwal wrote:
> On 09/17/2014 01:39 PM, Siddharth Agarwal wrote:
>> # HG changeset patch
>> # User Siddharth Agarwal <sid0@fb.com>
>> # Date 1410986304 25200
>> #      Wed Sep 17 13:38:24 2014 -0700
>> # Node ID c3e23fbf7bd71300f19522d583ab8fe50916b7f7
>> # Parent  6328e005b6c8f3f080bae829417ec195827165fb
>> evolve: wrap setparents calls in begin/endparentchange

pushed thanks

>
> Forgot to flag this [evolve].
>
>>
>> Mercurial rev d259322a394b added a requirement to wrap any
>> dirstate.setparents
>> calls and their associated dirstate changes in begin/endparentchange.
>>
>> diff --git a/hgext/evolve.py b/hgext/evolve.py
>> --- a/hgext/evolve.py
>> +++ b/hgext/evolve.py
>> @@ -1451,7 +1451,9 @@
>>       finally:
>>           tr.release()
>>       # reroute the working copy parent to the new changeset
>> +    repo.dirstate.beginparentchange()
>>       repo.dirstate.setparents(newid, node.nullid)
>> +    repo.dirstate.endparentchange()
>>   def _solvedivergent(ui, repo, divergent, dryrun=False, confirm=False,
>>                       progresscb=None):
>> @@ -1539,7 +1541,9 @@
>>       if progresscb: progresscb()
>>       tr = repo.transaction('stabilize-divergent')
>>       try:
>> +        repo.dirstate.beginparentchange()
>>           repo.dirstate.setparents(divergent.node(), node.nullid)
>> +        repo.dirstate.endparentchange()
>>           oldlen = len(repo)
>>           amend(ui, repo, message='', logfile='')
>>           if oldlen == len(repo):
>> @@ -1988,8 +1992,10 @@
>>           # Move local changes on filtered changeset
>>           obsolete.createmarkers(repo, [(old, (repo[newid],))])
>>           phases.retractboundary(repo, tr, oldphase, [newid])
>> +        repo.dirstate.beginparentchange()
>>           repo.dirstate.setparents(newid, node.nullid)
>>           _uncommitdirstate(repo, old, match)
>> +        repo.dirstate.endparentchange()
>>           updatebookmarks(newid)
>>           if not repo[newid].files():
>>               ui.warn(_("new changeset is empty\n"))
>> @@ -2075,7 +2081,9 @@
>>                       obsolete.createmarkers(repo, [(ctx, (repo[new],))])
>>                   phases.retractboundary(repo, tr, ctx.phase(), [new])
>>                   if ctx in repo[None].parents():
>> +                    repo.dirstate.beginparentchange()
>>                       repo.dirstate.setparents(new, node.nullid)
>> +                    repo.dirstate.endparentchange()
>>               tr.close()
>>           finally:
>>               tr.release()
>> _______________________________________________
>> Mercurial-devel mailing list
>> Mercurial-devel@selenic.com
>> http://selenic.com/mailman/listinfo/mercurial-devel
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff --git a/hgext/evolve.py b/hgext/evolve.py
--- a/hgext/evolve.py
+++ b/hgext/evolve.py
@@ -1451,7 +1451,9 @@ 
     finally:
         tr.release()
     # reroute the working copy parent to the new changeset
+    repo.dirstate.beginparentchange()
     repo.dirstate.setparents(newid, node.nullid)
+    repo.dirstate.endparentchange()
 
 def _solvedivergent(ui, repo, divergent, dryrun=False, confirm=False,
                     progresscb=None):
@@ -1539,7 +1541,9 @@ 
     if progresscb: progresscb()
     tr = repo.transaction('stabilize-divergent')
     try:
+        repo.dirstate.beginparentchange()
         repo.dirstate.setparents(divergent.node(), node.nullid)
+        repo.dirstate.endparentchange()
         oldlen = len(repo)
         amend(ui, repo, message='', logfile='')
         if oldlen == len(repo):
@@ -1988,8 +1992,10 @@ 
         # Move local changes on filtered changeset
         obsolete.createmarkers(repo, [(old, (repo[newid],))])
         phases.retractboundary(repo, tr, oldphase, [newid])
+        repo.dirstate.beginparentchange()
         repo.dirstate.setparents(newid, node.nullid)
         _uncommitdirstate(repo, old, match)
+        repo.dirstate.endparentchange()
         updatebookmarks(newid)
         if not repo[newid].files():
             ui.warn(_("new changeset is empty\n"))
@@ -2075,7 +2081,9 @@ 
                     obsolete.createmarkers(repo, [(ctx, (repo[new],))])
                 phases.retractboundary(repo, tr, ctx.phase(), [new])
                 if ctx in repo[None].parents():
+                    repo.dirstate.beginparentchange()
                     repo.dirstate.setparents(new, node.nullid)
+                    repo.dirstate.endparentchange()
             tr.close()
         finally:
             tr.release()