Patchwork [1,of,7] strip: move attributes shortcut assigned earlier

login
register
mail settings
Submitter Boris Feld
Date Jan. 2, 2019, 10:35 p.m.
Message ID <7aeb9adbfd1b1fdb4a9c.1546468549@Laptop-Boris.lan>
Download mbox | patch
Permalink /patch/37424/
State Accepted
Headers show

Comments

Boris Feld - Jan. 2, 2019, 10:35 p.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1546401745 -3600
#      Wed Jan 02 05:02:25 2019 +0100
# Node ID 7aeb9adbfd1b1fdb4a9c5ba597840a4f05f7e59f
# Parent  5c68b617ba2463eb6f1372a24b139a376c6bf6bd
# EXP-Topic archived-phase-UX
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 7aeb9adbfd1b
strip: move attributes shortcut assigned earlier

This series will add support for "soft" stripping using the archived phase in
addition to the usual heavy weight revlog stripping. First, we need to
refactor the strip function to extract logic common to the "soft-strip" case.

We are about to extract bits of the strip function into separate functions.
Those blocks of code contain variables for frequently accessed attributes. We
move those variables outside of the soon to be moved blocks.

Patch

diff --git a/mercurial/repair.py b/mercurial/repair.py
--- a/mercurial/repair.py
+++ b/mercurial/repair.py
@@ -108,8 +108,9 @@  def strip(ui, repo, nodelist, backup=Tru
 
     repo = repo.unfiltered()
     repo.destroying()
+    vfs = repo.vfs
+    cl = repo.changelog
 
-    cl = repo.changelog
     # TODO handle undo of merge sets
     if isinstance(nodelist, str):
         nodelist = [nodelist]
@@ -169,7 +170,6 @@  def strip(ui, repo, nodelist, backup=Tru
 
     # create a changegroup for all the branches we need to keep
     backupfile = None
-    vfs = repo.vfs
     node = nodelist[-1]
     if backup:
         backupfile = backupbundle(repo, stripbases, cl.heads(), node, topic)