Patchwork [8,of,8,shelve-ext,v2] shelve: move shelve-finishing logic to a separate function

login
register
mail settings
Submitter Kostia Balytskyi
Date Nov. 10, 2016, 11:37 a.m.
Message ID <2188194ca1ee86953855.1478777852@dev1902.lla1.facebook.com>
Download mbox | patch
Permalink /patch/17442/
State Accepted
Headers show

Comments

Kostia Balytskyi - Nov. 10, 2016, 11:37 a.m.
# HG changeset patch
# User Kostia Balytskyi <ikostia@fb.com>
# Date 1478776541 28800
#      Thu Nov 10 03:15:41 2016 -0800
# Node ID 2188194ca1ee86953855e0d2fb9396ec18636ed9
# Parent  d77543b3c0f6cd8dfc00be6060ef93743d98eeeb
shelve: move shelve-finishing logic to a separate function

With future obs-based shelve, finishing shelve will be different
from just aborting a transaction and I would like to keep both
variants of this functionality in a separate function.

Patch

diff --git a/hgext/shelve.py b/hgext/shelve.py
--- a/hgext/shelve.py
+++ b/hgext/shelve.py
@@ -342,6 +342,9 @@  def _includeunknownfiles(repo, pats, opt
         extra['shelve_unknown'] = '\0'.join(s.unknown)
         repo[None].add(s.unknown)
 
+def _finishshelve(repo):
+    _aborttransaction(repo)
+
 def _docreatecmd(ui, repo, pats, opts):
     wctx = repo[None]
     parents = wctx.parents()
@@ -399,7 +402,7 @@  def _docreatecmd(ui, repo, pats, opts):
         if origbranch != repo['.'].branch() and not _isbareshelve(pats, opts):
             repo.dirstate.setbranch(origbranch)
 
-        _aborttransaction(repo)
+        _finishshelve(repo)
     finally:
         lockmod.release(tr, lock)