diff hgext3rd/pullbundle.py @ 4134:ab77f37fedf3

pullbundle: add a config option for the cache directory
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 24 Sep 2018 00:28:10 +0200
parents 1293625d274d
children 47f1d7b4305d
line wrap: on
line diff
--- a/hgext3rd/pullbundle.py	Sun Sep 23 22:58:11 2018 +0200
+++ b/hgext3rd/pullbundle.py	Mon Sep 24 00:28:10 2018 +0200
@@ -39,6 +39,14 @@
     [experimental]
     evolution.exchange=no
 
+Extra Configuration
+===================
+
+  [pullbundle]
+  # By default bundles are stored `.hg/cache/pullbundles/.
+  # This can be changed with the following config:
+  cache-directory=/absolute/path
+
 Implementation status
 =====================
 
@@ -69,11 +77,19 @@
     exchange,
     narrowspec,
     node as nodemod,
+    registrar,
     util,
 )
 
 from mercurial.i18n import _
 
+configtable = {}
+configitem = registrar.configitem(configtable)
+
+configitem('pullbundle', 'cache-directory',
+           default=None,
+)
+
 # generic wrapping
 
 def uisetup(ui):
@@ -310,6 +326,9 @@
 # cache management
 
 def cachedir(repo):
+    cachedir = repo.ui.config('pullbundle', 'cache-directory')
+    if cachedir is not None:
+        return cachedir
     return repo.cachevfs.join('pullbundles')
 
 def getcache(repo, bundlename):