Patchwork [8,of,8] largefiles: use "autoupdate" to wrap automated updating for rebase

login
register
mail settings
Submitter Katsunori FUJIWARA
Date Sept. 9, 2014, 6:18 p.m.
Message ID <b0b0a8861e4d4320ce60.1410286732@feefifofum>
Download mbox | patch
Permalink /patch/5754/
State Changes Requested
Headers show

Comments

Katsunori FUJIWARA - Sept. 9, 2014, 6:18 p.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
# Date 1410286454 -32400
#      Wed Sep 10 03:14:14 2014 +0900
# Node ID b0b0a8861e4d4320ce60917e40d21d185e797666
# Parent  8135c7dc8f6db4823753b2c1bd8c2a28c369fd3f
largefiles: use "autoupdate" to wrap automated updating for rebase

This patch uses "cmdutil.autoupdate" to wrap "rebase.rebasenode" as
the function for automated updating, instead of direct wrapping by
"rebaserebasenode".

Changes in this patch allow rebase extension to change around updating
without adjusting other extensions (largefiles, for example), while
rebase extension uses "autoupdate" framework.

Patch

diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py
+++ b/hgext/largefiles/overrides.py
@@ -1355,10 +1355,3 @@ 
             repo._lfautocommit = False
 
     return orig(commandname, repo, wrapper)
-
-def rebaserebasenode(orig, repo, *args, **kwargs):
-    repo._lfautocommit = 'rebase'
-    try:
-        return orig(repo, *args, **kwargs)
-    finally:
-        repo._lfautocommit = False
diff --git a/hgext/largefiles/uisetup.py b/hgext/largefiles/uisetup.py
--- a/hgext/largefiles/uisetup.py
+++ b/hgext/largefiles/uisetup.py
@@ -170,9 +170,6 @@ 
         if name == 'purge':
             extensions.wrapcommand(getattr(module, 'cmdtable'), 'purge',
                 overrides.overridepurge)
-        if name == 'rebase':
-            extensions.wrapfunction(module, 'rebasenode',
-                                    overrides.rebaserebasenode)
         if name == 'transplant':
             extensions.wrapcommand(getattr(module, 'cmdtable'), 'transplant',
                 overrides.overridetransplant)
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -324,6 +324,7 @@ 
             return cmdutil.autocommit("rebase", repo, concludenode,
                                       resuming=resuming)
         commitfunc = autocommit(contf)
+        rebasefunc = cmdutil.autoupdate("rebase", repo, rebasenode)
         for rev in sortedstate:
             pos += 1
             if state[rev] == -1:
@@ -339,7 +340,7 @@ 
                     try:
                         ui.setconfig('ui', 'forcemerge', opts.get('tool', ''),
                                      'rebase')
-                        stats = rebasenode(repo, rev, p1, state, collapsef)
+                        stats = rebasefunc(repo, rev, p1, state, collapsef)
                         if stats and stats[3] > 0:
                             raise error.InterventionRequired(
                                 _('unresolved conflicts (see hg '