Patchwork [10,of,10,shelve-ext,v2] shelve: disable inhibit for shelving period

login
register
mail settings
Submitter Kostia Balytskyi
Date Jan. 19, 2017, 3:10 p.m.
Message ID <6a7e7659886d35dfdc4d.1484838637@devvm1416.lla2.facebook.com>
Download mbox | patch
Permalink /patch/18258/
State Deferred
Headers show

Comments

Kostia Balytskyi - Jan. 19, 2017, 3:10 p.m.
# HG changeset patch
# User Kostia Balytskyi <ikostia@fb.com>
# Date 1484838335 28800
#      Thu Jan 19 07:05:35 2017 -0800
# Node ID 6a7e7659886d35dfdc4d7d5efb3ef8479ae35367
# Parent  088c9191d662d5c0003310119c51540926a815f7
shelve: disable inhibit for shelving period

While shelving, we're creating a new commit and updating to it.
If inhibit is enabled, it will try to add this commit to an
inhibition set, which is not necessary (we're creating a marker
right after we perform this operation). Thus, disabling inhibit
speeds things up a bit.

Patch

diff --git a/hgext/shelve.py b/hgext/shelve.py
--- a/hgext/shelve.py
+++ b/hgext/shelve.py
@@ -447,8 +447,12 @@  def _docreatecmd(ui, repo, pats, opts):
         opts['message'] = desc
 
     lock = tr = activebookmark = None
+    _obsinhibit = _notset = object()
     try:
         lock = repo.lock()
+        if util.safehasattr(repo, '_obsinhibit'):
+            _obsinhibit = getattr(repo, '_obsinhibit')
+            del repo._obsinhibit
 
         # depending on whether shelve is traditional or
         # obsolescense-based, we either abort or commit this
@@ -498,6 +502,8 @@  def _docreatecmd(ui, repo, pats, opts):
         _finishshelve(ui, repo, tr, node, activebookmark)
     finally:
         _restoreactivebookmark(repo, activebookmark)
+        if _obsinhibit is not _notset:
+            repo._obsinhibit = _obsinhibit
         lockmod.release(tr, lock)
 
 def _isbareshelve(pats, opts):