diff hgext/largefiles/lfcommands.py @ 18974:d78a136a8036

largefiles: fix cat of non-largefiles from subdirectory We were calling back to the original commands.cat from inside the walk loop that handled and filtered out largefiles. That did however happen with file paths relative to repo root and the original cat would fail when it applied its own walk and match on top of that. Instead we now duplicate and modify the code from commands.cat and patch it to handle both normal and largefiles. A change in test output shows that this also makes the exit code with largefiles consistent with the normal one in the case where one of several specified files are missing. This also fixes the combination of --output and largefiles.
author Mads Kiilerich <madski@unity3d.com>
date Mon, 15 Apr 2013 01:43:31 +0200
parents 5f9019e6d451
children 6734951e2d24
line wrap: on
line diff
--- a/hgext/largefiles/lfcommands.py	Mon Apr 15 01:41:49 2013 +0200
+++ b/hgext/largefiles/lfcommands.py	Mon Apr 15 01:43:31 2013 +0200
@@ -530,24 +530,6 @@
         lfdirstate.drop(lfile)
     return ret
 
-def catlfile(repo, lfile, rev, filename):
-    hash = lfutil.readstandin(repo, lfile, rev)
-    if not lfutil.inusercache(repo.ui, hash):
-        store = basestore._openstore(repo)
-        success, missing = store.get([(lfile, hash)])
-        if len(success) != 1:
-            raise util.Abort(
-                _('largefile %s is not in cache and could not be downloaded')
-                    % lfile)
-    path = lfutil.usercachepath(repo.ui, hash)
-    fpout = cmdutil.makefileobj(repo, filename)
-    fpin = open(path, "rb")
-    for chunk in lfutil.blockstream(fpin):
-        fpout.write(chunk)
-    fpout.close()
-    fpin.close()
-    return 0
-
 # -- hg commands declarations ------------------------------------------------
 
 cmdtable = {