diff hgext/largefiles/reposetup.py @ 19779:fb6e87d93948

largefiles: setup "largefiles" feature in each repositories individually Before this patch, if largefiles extension is enabled once in any of target repositories, commands handling multiple repositories at a time like below misunderstand that "largefiles" feature is supported also in all other local repositories: - clone/pull from or push to localhost - recursive execution in subrepo tree This patch registers "featuresetup()" into "featuresetupfuncs" of "localrepository" to support "largefiles" features only in repositories enabling largefiles extension, instead of adding "largefiles" feature to class variable "_basesupported" of "localrepository". This patch also adds checking below to the largefiles specific class derived from "localrepository": - push to localhost: whether features supported in the local(= dst) repository satisfies ones required in the remote(= src) This can prevent useless looking up in the remote repository, when supported and required features are mismatched: "push()" of "localrepository" also checks it, but it is executed after looking up in the remote.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Sat, 21 Sep 2013 21:33:29 +0900
parents f69ebcb06ce2
children c5f0574034ef
line wrap: on
line diff
--- a/hgext/largefiles/reposetup.py	Sat Sep 21 21:33:29 2013 +0900
+++ b/hgext/largefiles/reposetup.py	Sat Sep 21 21:33:29 2013 +0900
@@ -407,6 +407,14 @@
                 wlock.release()
 
         def push(self, remote, force=False, revs=None, newbranch=False):
+            if remote.local():
+                missing = set(self.requirements) - remote.local().supported
+                if missing:
+                    msg = _("required features are not"
+                            " supported in the destination:"
+                            " %s") % (', '.join(sorted(missing)))
+                    raise util.Abort(msg)
+
             outgoing = discovery.findcommonoutgoing(repo, remote.peer(),
                                                     force=force)
             if outgoing.missing: