[PATCH 1 of 2 V2] remotenames: selectivepull, move reading config option into separate function

Stanislau Hlebik stash at fb.com
Thu Aug 18 10:53:32 UTC 2016


# HG changeset patch
# User Stanislau Hlebik <stash at fb.com>
# Date 1471517292 25200
#      Thu Aug 18 03:48:12 2016 -0700
# Node ID 866049ffa049dc598af834a035f27a06684d264d
# Parent  069b8a5f40ec450aebccd2658ec49a1c694687a2
remotenames: selectivepull, move reading config option into separate function

It will be read in a few places so it's better move it to avoid copy-paste

Test Plan:
Run remotenames tests

diff --git a/remotenames.py b/remotenames.py
--- a/remotenames.py
+++ b/remotenames.py
@@ -73,10 +73,12 @@
     for flag in ['to', 'delete', 'create', 'allowanon', 'nonforwardmove']:
         setattr(pushop, flag, kwargs.get(flag))
 
+def _isselectivepull(ui):
+    return ui.configbool('remotenames', 'selectivepull', False)
+
 def expull(orig, repo, remote, *args, **kwargs):
-    isselectivepull = repo.ui.configbool('remotenames', 'selectivepull', False)
     remotebookmarks = remote.listkeys('bookmarks')
-    if isselectivepull:
+    if _isselectivepull(repo.ui):
         path = activepath(repo.ui, remote)
         bookmarks = {}
         for bookmark in readbookmarknames(repo, path):


More information about the Mercurial-devel mailing list