hgext/lfs/__init__.py
changeset 35735 693e3bcae19e
parent 35732 10e62d5efa73
child 35741 73432eee0ac4
--- a/hgext/lfs/__init__.py	Thu Jan 18 18:04:56 2018 -0500
+++ b/hgext/lfs/__init__.py	Thu Jan 18 21:18:10 2018 -0500
@@ -160,9 +160,6 @@
     repo.svfs.lfslocalblobstore = blobstore.local(repo)
     repo.svfs.lfsremoteblobstore = blobstore.remote(repo)
 
-    # Push hook
-    repo.prepushoutgoinghooks.add('lfs', wrapper.prepush)
-
     class lfsrepo(repo.__class__):
         @localrepo.unfilteredmethod
         def commitctx(self, ctx, error=False):
@@ -185,10 +182,13 @@
                 if any(ctx[f].islfs() for f in ctx.files() if f in ctx):
                     repo.requirements.add('lfs')
                     repo._writerequirements()
+                    repo.prepushoutgoinghooks.add('lfs', wrapper.prepush)
                     break
 
         ui.setconfig('hooks', 'commit.lfs', checkrequireslfs, 'lfs')
         ui.setconfig('hooks', 'pretxnchangegroup.lfs', checkrequireslfs, 'lfs')
+    else:
+        repo.prepushoutgoinghooks.add('lfs', wrapper.prepush)
 
 def _trackedmatcher(repo, ctx):
     """Return a function (path, size) -> bool indicating whether or not to