diff --git a/hgext/lfs/__init__.py b/hgext/lfs/__init__.py
index bbcd2e478391b764759d52712ff77f639ab0700a_aGdleHQvbGZzL19faW5pdF9fLnB5..6bb940de4c4cdda0b3867a895720d487c52668fc_aGdleHQvbGZzL19faW5pdF9fLnB5 100644
--- a/hgext/lfs/__init__.py
+++ b/hgext/lfs/__init__.py
@@ -43,6 +43,7 @@
     filelog,
     hg,
     localrepo,
+    node,
     registrar,
     revlog,
     scmutil,
@@ -122,8 +123,14 @@
     if 'lfs' not in repo.requirements:
         def checkrequireslfs(ui, repo, **kwargs):
             if 'lfs' not in repo.requirements:
-                ctx = repo[kwargs['node']]
+                last = kwargs.get('node_last')
+                _bin = node.bin
+                if last:
+                    s = repo.set('%n:%n', _bin(kwargs['node']), _bin(last))
+                else:
+                    s = repo.set('%n', _bin(kwargs['node']))
+            for ctx in s:
                 # TODO: is there a way to just walk the files in the commit?
                 if any(ctx[f].islfs() for f in ctx.files() if f in ctx):
                     repo.requirements.add('lfs')
                     repo._writerequirements()
@@ -126,6 +133,7 @@
                 # TODO: is there a way to just walk the files in the commit?
                 if any(ctx[f].islfs() for f in ctx.files() if f in ctx):
                     repo.requirements.add('lfs')
                     repo._writerequirements()
+                    break
 
         ui.setconfig('hooks', 'commit.lfs', checkrequireslfs, 'lfs')
@@ -130,5 +138,6 @@
 
         ui.setconfig('hooks', 'commit.lfs', checkrequireslfs, 'lfs')
+        ui.setconfig('hooks', 'pretxnchangegroup.lfs', checkrequireslfs, 'lfs')
 
 def wrapfilelog(filelog):
     wrapfunction = extensions.wrapfunction
diff --git a/tests/test-lfs-serve.t b/tests/test-lfs-serve.t
index bbcd2e478391b764759d52712ff77f639ab0700a_dGVzdHMvdGVzdC1sZnMtc2VydmUudA==..6bb940de4c4cdda0b3867a895720d487c52668fc_dGVzdHMvdGVzdC1sZnMtc2VydmUudA== 100644
--- a/tests/test-lfs-serve.t
+++ b/tests/test-lfs-serve.t
@@ -130,5 +130,6 @@
 
 --------------------------------------------------------------------------------
 Case #3: client with lfs content and the extension enabled; server with
-non-lfs content, and the extension state controlled by #testcases.
+non-lfs content, and the extension state controlled by #testcases.  The server
+should have an 'lfs' requirement after it picks up its first commit with a blob.
 
@@ -134,5 +135,4 @@
 
-TODO: add the 'lfs' requirement on the server for each test in lfsremote-on
   $ echo 'this is a big lfs file' > lfs.bin
   $ hg ci -Aqm 'lfs'
   $ grep 'lfs' .hg/requires $SERVER_REQUIRES
@@ -144,5 +144,6 @@
   ValueError: no common changegroup version (lfsremote-off !)
   $ grep 'lfs' .hg/requires $SERVER_REQUIRES
   .hg/requires:lfs
+  $TESTTMP/server/.hg/requires:lfs (lfsremote-on !)
 
   $ hg clone -q http://localhost:$HGPORT $TESTTMP/client3_clone
@@ -147,7 +148,8 @@
 
   $ hg clone -q http://localhost:$HGPORT $TESTTMP/client3_clone
-  $ grep 'lfs' $TESTTMP/client3_clone/.hg/requires $SERVER_REQUIRES
-  [1]
+  $ grep 'lfs' $TESTTMP/client3_clone/.hg/requires $SERVER_REQUIRES || true
+  $TESTTMP/client3_clone/.hg/requires:lfs (lfsremote-on !)
+  $TESTTMP/server/.hg/requires:lfs (lfsremote-on !)
 
   $ hg init $TESTTMP/client3_pull
   $ hg -R $TESTTMP/client3_pull pull -q http://localhost:$HGPORT
@@ -151,8 +153,9 @@
 
   $ hg init $TESTTMP/client3_pull
   $ hg -R $TESTTMP/client3_pull pull -q http://localhost:$HGPORT
-  $ grep 'lfs' $TESTTMP/client3_pull/.hg/requires $SERVER_REQUIRES
-  [1]
+  $ grep 'lfs' $TESTTMP/client3_pull/.hg/requires $SERVER_REQUIRES || true
+  $TESTTMP/client3_pull/.hg/requires:lfs (lfsremote-on !)
+  $TESTTMP/server/.hg/requires:lfs (lfsremote-on !)
 
 XXX: The difference here is the push failed above when the extension isn't
 enabled on the server.  The extension shouldn't need to mess with changegroup
@@ -185,8 +188,8 @@
   $ echo 'non-lfs' > nonlfs2.txt
   $ hg ci -Aqm 'non-lfs'
   $ grep 'lfs' .hg/requires $SERVER_REQUIRES
-  [1]
+  $TESTTMP/server/.hg/requires:lfs
 
   $ hg push -q --force
   warning: repository is unrelated
   $ grep 'lfs' .hg/requires $SERVER_REQUIRES
@@ -189,8 +192,8 @@
 
   $ hg push -q --force
   warning: repository is unrelated
   $ grep 'lfs' .hg/requires $SERVER_REQUIRES
-  [1]
+  $TESTTMP/server/.hg/requires:lfs
 
 TODO: fail more gracefully.
 
@@ -199,6 +202,7 @@
   [255]
   $ grep 'lfs' $TESTTMP/client4_clone/.hg/requires $SERVER_REQUIRES
   grep: $TESTTMP/client4_clone/.hg/requires: $ENOENT$
+  $TESTTMP/server/.hg/requires:lfs
   [2]
 
 TODO: fail more gracefully.
@@ -208,7 +212,7 @@
   abort: HTTP Error 500: Internal Server Error
   [255]
   $ grep 'lfs' $TESTTMP/client4_pull/.hg/requires $SERVER_REQUIRES
-  [1]
+  $TESTTMP/server/.hg/requires:lfs
 
   $ hg identify http://localhost:$HGPORT
   03b080fa9d93
@@ -226,7 +230,7 @@
 
   $ hg push -q
   $ grep 'lfs' .hg/requires $SERVER_REQUIRES
-  [1]
+  $TESTTMP/server/.hg/requires:lfs
 
   $ hg clone -q http://localhost:$HGPORT $TESTTMP/client5_clone
   $ grep 'lfs' $TESTTMP/client5_clone/.hg/requires $SERVER_REQUIRES
@@ -230,8 +234,9 @@
 
   $ hg clone -q http://localhost:$HGPORT $TESTTMP/client5_clone
   $ grep 'lfs' $TESTTMP/client5_clone/.hg/requires $SERVER_REQUIRES
-  [1]
+  $TESTTMP/client5_clone/.hg/requires:lfs
+  $TESTTMP/server/.hg/requires:lfs
 
   $ hg init $TESTTMP/client5_pull
   $ hg -R $TESTTMP/client5_pull pull -q http://localhost:$HGPORT
   $ grep 'lfs' $TESTTMP/client5_pull/.hg/requires $SERVER_REQUIRES
@@ -234,8 +239,9 @@
 
   $ hg init $TESTTMP/client5_pull
   $ hg -R $TESTTMP/client5_pull pull -q http://localhost:$HGPORT
   $ grep 'lfs' $TESTTMP/client5_pull/.hg/requires $SERVER_REQUIRES
-  [1]
+  $TESTTMP/client5_pull/.hg/requires:lfs
+  $TESTTMP/server/.hg/requires:lfs
 
   $ hg identify http://localhost:$HGPORT
   c729025cc5e3
@@ -244,11 +250,9 @@
 Case #6: client with lfs content and the extension enabled; server with
 lfs content, and the extension enabled.
 
-TODO: add the 'lfs' requirement on the server for each test
-
   $ echo 'this is another lfs file' > lfs2.txt
   $ hg ci -Aqm 'lfs file with lfs client'
 
   $ hg push -q
   $ grep 'lfs' .hg/requires $SERVER_REQUIRES
   .hg/requires:lfs
@@ -249,9 +253,10 @@
   $ echo 'this is another lfs file' > lfs2.txt
   $ hg ci -Aqm 'lfs file with lfs client'
 
   $ hg push -q
   $ grep 'lfs' .hg/requires $SERVER_REQUIRES
   .hg/requires:lfs
+  $TESTTMP/server/.hg/requires:lfs
 
   $ hg clone -q http://localhost:$HGPORT $TESTTMP/client6_clone
   $ grep 'lfs' $TESTTMP/client6_clone/.hg/requires $SERVER_REQUIRES
@@ -255,8 +260,9 @@
 
   $ hg clone -q http://localhost:$HGPORT $TESTTMP/client6_clone
   $ grep 'lfs' $TESTTMP/client6_clone/.hg/requires $SERVER_REQUIRES
-  [1]
+  $TESTTMP/client6_clone/.hg/requires:lfs
+  $TESTTMP/server/.hg/requires:lfs
 
   $ hg init $TESTTMP/client6_pull
   $ hg -R $TESTTMP/client6_pull pull -q http://localhost:$HGPORT
   $ grep 'lfs' $TESTTMP/client6_pull/.hg/requires $SERVER_REQUIRES
@@ -259,8 +265,9 @@
 
   $ hg init $TESTTMP/client6_pull
   $ hg -R $TESTTMP/client6_pull pull -q http://localhost:$HGPORT
   $ grep 'lfs' $TESTTMP/client6_pull/.hg/requires $SERVER_REQUIRES
-  [1]
+  $TESTTMP/client6_pull/.hg/requires:lfs
+  $TESTTMP/server/.hg/requires:lfs
 
   $ hg identify http://localhost:$HGPORT
   d3b84d50eacb
diff --git a/tests/test-lfs-test-server.t b/tests/test-lfs-test-server.t
index bbcd2e478391b764759d52712ff77f639ab0700a_dGVzdHMvdGVzdC1sZnMtdGVzdC1zZXJ2ZXIudA==..6bb940de4c4cdda0b3867a895720d487c52668fc_dGVzdHMvdGVzdC1sZnMtdGVzdC1zZXJ2ZXIudA== 100644
--- a/tests/test-lfs-test-server.t
+++ b/tests/test-lfs-test-server.t
@@ -53,6 +53,7 @@
   adding manifests
   adding file changes
   added 1 changesets with 1 changes to 1 files
+  calling hook pretxnchangegroup.lfs: hgext.lfs.checkrequireslfs
 
 Clear the cache to force a download
   $ rm -rf `hg config lfs.usercache`
diff --git a/tests/test-lfs.t b/tests/test-lfs.t
index bbcd2e478391b764759d52712ff77f639ab0700a_dGVzdHMvdGVzdC1sZnMudA==..6bb940de4c4cdda0b3867a895720d487c52668fc_dGVzdHMvdGVzdC1sZnMudA== 100644
--- a/tests/test-lfs.t
+++ b/tests/test-lfs.t
@@ -56,7 +56,7 @@
   > url=file:$TESTTMP/dummy-remote/
   > EOF
 
-TODO: Push to a local non-lfs repo with the extension enabled should add the
+Push to a local non-lfs repo with the extension enabled will add the
 lfs requirement
 
   $ grep lfs $TESTTMP/server/.hg/requires
@@ -70,4 +70,5 @@
   adding manifests
   adding file changes
   added 2 changesets with 2 changes to 2 files
+  calling hook pretxnchangegroup.lfs: hgext.lfs.checkrequireslfs
   $ grep lfs $TESTTMP/server/.hg/requires
@@ -73,5 +74,5 @@
   $ grep lfs $TESTTMP/server/.hg/requires
-  [1]
+  lfs
 
 # Unknown URL scheme
 
@@ -91,7 +92,7 @@
 
 # Pull from server
 
-TODO: Pulling a local lfs repo into a local non-lfs repo with the extension
-enabled should add the lfs requirement
+Pulling a local lfs repo into a local non-lfs repo with the extension
+enabled adds the lfs requirement
 
   $ grep lfs .hg/requires $TESTTMP/server/.hg/requires
@@ -96,6 +97,6 @@
 
   $ grep lfs .hg/requires $TESTTMP/server/.hg/requires
-  [1]
+  $TESTTMP/server/.hg/requires:lfs
   $ hg pull default
   pulling from $TESTTMP/server
   requesting all changes
@@ -106,7 +107,8 @@
   new changesets b29ba743f89d:00c137947d30
   (run 'hg update' to get a working copy)
   $ grep lfs .hg/requires $TESTTMP/server/.hg/requires
-  [1]
+  .hg/requires:lfs
+  $TESTTMP/server/.hg/requires:lfs
 
 # Check the blobstore is not yet populated
   $ [ -d .hg/store/lfs/objects ]
@@ -872,7 +874,7 @@
   $ hg commit -m 'rm A'
   $ cd ..
 
-TODO: Unbundling adds a requirement to a non-lfs repo, if necessary.
+Unbundling adds a requirement to a non-lfs repo, if necessary.
 
   $ hg bundle -R $TESTTMP/repo-del -qr 0 --base null nolfs.hg
   $ hg bundle -R convert_lfs2 -qr tip --base null lfs.hg
@@ -882,7 +884,7 @@
   [1]
   $ hg pull -R unbundle -q lfs.hg
   $ grep lfs unbundle/.hg/requires
-  [1]
+  lfs
 
   $ hg init no_lfs
   $ cat >> no_lfs/.hg/hgrc <<EOF