Patchwork D3719: narrowbundle2: when we handle a widen, mark the operation as unsafe

login
register
mail settings
Submitter phabricator
Date June 12, 2018, 3:31 p.m.
Message ID <differential-rev-PHID-DREV-pshmobhminutudsdfipj-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/32088/
State Superseded
Headers show

Comments

phabricator - June 12, 2018, 3:31 p.m.
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  We have to manually drive the context manager here since the logic is
  awkwardly split between a couple of places.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3719

AFFECTED FILES
  hgext/narrow/narrowbundle2.py

CHANGE DETAILS




To: durin42, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/hgext/narrow/narrowbundle2.py b/hgext/narrow/narrowbundle2.py
--- a/hgext/narrow/narrowbundle2.py
+++ b/hgext/narrow/narrowbundle2.py
@@ -408,6 +408,8 @@ 
                                  topic='widen')
         repo._bookmarks = bmstore
         if chgrpfile:
+            op._widen_unsafeop = repo.ui.unsafeoperation()
+            op._widen_unsafeop.__enter__()
             # presence of _widen_bundle attribute activates widen handler later
             op._widen_bundle = chgrpfile
     # Set the new narrowspec if we're widening. The setnewnarrowpats() method
@@ -455,6 +457,7 @@ 
                         (undovfs.join(undofile), stringutil.forcebytestr(e)))
 
     # Remove partial backup only if there were no exceptions
+    op._widen_unsafeop.__exit__(None, None, None)
     vfs.unlink(chgrpfile)
 
 def setup():