Patchwork [2,of,9,stable] largefiles: fix download of largefiles from an empty list of changesets

login
register
mail settings
Submitter Mads Kiilerich
Date Feb. 26, 2013, 2:41 a.m.
Message ID <27f081501f9e04320ac9.1361846482@mk-desktop>
Download mbox | patch
Permalink /patch/1049/
State Accepted
Commit f0aa8bbffe60498349841f4f4aff20471989d77e
Headers show

Comments

Mads Kiilerich - Feb. 26, 2013, 2:41 a.m.
# HG changeset patch
# User Mads Kiilerich <madski@unity3d.com>
# Date 1361846443 -3600
# Branch stable
# Node ID 27f081501f9e04320ac94654c61e766764ee159e
# Parent  7f0cd251905074b0aec181892efc80fa18507fde
largefiles: fix download of largefiles from an empty list of changesets

The empty list was interpreted as all revisions - just like None is.

The empty list is now handled explicitly.

Patch

diff --git a/hgext/largefiles/lfcommands.py b/hgext/largefiles/lfcommands.py
--- a/hgext/largefiles/lfcommands.py
+++ b/hgext/largefiles/lfcommands.py
@@ -435,11 +435,12 @@ 
         pass
     totalsuccess = 0
     totalmissing = 0
-    for ctx in cmdutil.walkchangerevs(repo, matchfn, {'rev' : rev},
-                                      prepare):
-        success, missing = cachelfiles(ui, repo, ctx.node())
-        totalsuccess += len(success)
-        totalmissing += len(missing)
+    if rev != []: # walkchangerevs on empty list would return all revs
+        for ctx in cmdutil.walkchangerevs(repo, matchfn, {'rev' : rev},
+                                          prepare):
+            success, missing = cachelfiles(ui, repo, ctx.node())
+            totalsuccess += len(success)
+            totalmissing += len(missing)
     ui.status(_("%d additional largefiles cached\n") % totalsuccess)
     if totalmissing > 0:
         ui.status(_("%d largefiles failed to download\n") % totalmissing)
diff --git a/tests/test-largefiles.t b/tests/test-largefiles.t
--- a/tests/test-largefiles.t
+++ b/tests/test-largefiles.t
@@ -1262,6 +1262,16 @@ 
 - cleanup
   $ rm $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
 
+Pulling 0 revisions with --all-largefiles should not fetch for all revisions
+
+  $ hg pull --all-largefiles
+  pulling from $TESTTMP/d (glob)
+  searching for changes
+  no changes found
+  caching new largefiles
+  0 largefiles cached
+  0 additional largefiles cached
+
 Merging does not revert to old versions of largefiles and also check
 that merging after having pulled from a non-default remote works
 correctly.