diff hgext/largefiles/reposetup.py @ 20858:bc56ec9e64df stable

hg: introduce "wirepeersetupfuncs" to setup wire peer by extensions (issue4109) Since changeset 6f72e7d28b35, "reposetup()" of each extensions is invoked only on repositories enabling corresponded extensions. This causes that largefiles specific interactions between the repository enabling largefiles locally and remote (wire) peer fail, because there is no way to know whether largefiles is enabled on the remote repository behind the wire peer, and largefiles specific "wireproto functions" are not given to any wire peers. To avoid this problem, largefiles should be enabled in wider scope than each repositories (e.g. user-wide "${HOME}/.hgrc"). This patch introduces "wirepeersetupfuncs" to setup wire peer by extensions already enabled. Functions registered into "wirepeersetupfuncs" are invoked for all wire peers. This patch uses plain list instead of "util.hooks" for "wirepeersetupfuncs", because the former allows to control order of function invocation by order of extension enabling: it may be useful for workaround of problems with combination of enabled extensions
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Sat, 29 Mar 2014 01:20:07 +0900
parents c5f0574034ef
children 81d6dc8c3c63
line wrap: on
line diff
--- a/hgext/largefiles/reposetup.py	Thu Mar 27 17:21:27 2014 -0500
+++ b/hgext/largefiles/reposetup.py	Sat Mar 29 01:20:07 2014 +0900
@@ -16,14 +16,13 @@
 from mercurial import localrepo
 
 import lfcommands
-import proto
 import lfutil
 
 def reposetup(ui, repo):
-    # wire repositories should be given new wireproto functions but not the
-    # other largefiles modifications
+    # wire repositories should be given new wireproto functions
+    # by "proto.wirereposetup()" via "hg.wirepeersetupfuncs"
     if not repo.local():
-        return proto.wirereposetup(ui, repo)
+        return
 
     class lfilesrepo(repo.__class__):
         lfstatus = False