Patchwork [1,of,2,V3,remotenames-ext] remotenames: selectivepull, move reading config option into separate function

login
register
mail settings
Submitter Stanislau Hlebik
Date Aug. 22, 2016, 10:17 a.m.
Message ID <866049ffa049dc598af8.1471861035@dev1918.lla1.facebook.com>
Download mbox | patch
Permalink /patch/16377/
State Accepted
Delegated to: Durham Goode
Headers show

Comments

Stanislau Hlebik - Aug. 22, 2016, 10:17 a.m.
# HG changeset patch
# User Stanislau Hlebik <stash@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

Patch

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):