hgext/largefiles/overrides.py
changeset 16109 cb756482c1aa
parent 16094 0776a6cababe
parent 16103 3e1efb458e8b
child 16120 47ee41fcf42b
--- a/hgext/largefiles/overrides.py	Fri Feb 10 13:50:13 2012 +0100
+++ b/hgext/largefiles/overrides.py	Fri Feb 10 17:09:23 2012 -0600
@@ -657,6 +657,7 @@
         repo.lfpullsource = source
         if not source:
             source = 'default'
+        oldheads = lfutil.getcurrentheads(repo)
         result = orig(ui, repo, source, **opts)
         # If we do not have the new largefiles for any new heads we pulled, we
         # will run into a problem later if we try to merge or rebase with one of
@@ -664,12 +665,11 @@
         # cache.
         ui.status(_("caching new largefiles\n"))
         numcached = 0
-        branches = repo.branchmap()
-        for branch in branches:
-            heads = repo.branchheads(branch)
-            for head in heads:
-                (cached, missing) = lfcommands.cachelfiles(ui, repo, head)
-                numcached += len(cached)
+        heads = lfutil.getcurrentheads(repo)
+        newheads = set(heads).difference(set(oldheads))
+        for head in newheads:
+            (cached, missing) = lfcommands.cachelfiles(ui, repo, head)
+            numcached += len(cached)
         ui.status(_("%d largefiles cached\n" % numcached))
     return result