diff hgext/largefiles/reposetup.py @ 28878:a75c9665ef06

largefiles: introduce push --lfrev to control which revisions are pushed The default of pushing all largefiles referenced in outgoing revisions is safe, but also expensive and sometimes not what is needed. We thus introduce a --lfrev option, similar to what pull already has. By specifying an empty set of revisions (or null), it is possible to get lazy (and insecure!) pushes of revisions without referenced largefiles, similar to how pull works.
author Mads Kiilerich <madski@unity3d.com>
date Sun, 27 Mar 2016 13:00:28 -0700
parents 79b8f052ee51
children bde283a1ad1a
line wrap: on
line diff
--- a/hgext/largefiles/reposetup.py	Wed Apr 13 01:45:45 2016 +0200
+++ b/hgext/largefiles/reposetup.py	Sun Mar 27 13:00:28 2016 -0700
@@ -353,10 +353,14 @@
     repo._lfstatuswriters = [ui.status]
 
     def prepushoutgoinghook(pushop):
-        if pushop.outgoing.missing:
+        """Push largefiles for pushop before pushing revisions."""
+        lfrevs = pushop.lfrevs
+        if lfrevs is None:
+            lfrevs = pushop.outgoing.missing
+        if lfrevs:
             toupload = set()
             addfunc = lambda fn, lfhash: toupload.add(lfhash)
-            lfutil.getlfilestoupload(pushop.repo, pushop.outgoing.missing,
+            lfutil.getlfilestoupload(pushop.repo, lfrevs,
                                      addfunc)
             lfcommands.uploadlfiles(ui, pushop.repo, pushop.remote, toupload)
     repo.prepushoutgoinghooks.add("largefiles", prepushoutgoinghook)