[PATCH 2 of 4 STABLE] largefiles: support revsets for cat

Matt Harbison matt_harbison at yahoo.com
Tue Jul 24 11:10:12 CDT 2012


# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1342826081 14400
# Branch stable
# Node ID d0c5997c76d4fc27acd31f4b1e4d5872df36f838
# Parent  abd456586c9fd771f47f2e0a6fdbbd47ffe17194
largefiles: support revsets for cat

Previous to this, cat only accepted revsets if the largefiles extension was
disabled.

diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py
+++ b/hgext/largefiles/overrides.py
@@ -1073,8 +1073,8 @@
     return result
 
 def overridecat(orig, ui, repo, file1, *pats, **opts):
-    rev = opts.get('rev')
-    if not lfutil.standin(file1) in repo[rev]:
+    ctx = scmutil.revsingle(repo, opts.get('rev'))
+    if not lfutil.standin(file1) in ctx:
         result = orig(ui, repo, file1, *pats, **opts)
         return result
-    return lfcommands.catlfile(repo, file1, opts.get('rev'), opts.get('output'))
+    return lfcommands.catlfile(repo, file1, ctx.rev(), opts.get('output'))
diff --git a/tests/test-largefiles.t b/tests/test-largefiles.t
--- a/tests/test-largefiles.t
+++ b/tests/test-largefiles.t
@@ -995,6 +995,10 @@
   $ rm cat.out
   $ hg cat -r a381d2c8c80e normal3
   normal3-modified
+  $ hg cat -r '.^' normal3
+  normal3-modified
+  $ hg cat -r '.^' sub/large4
+  large4-modified
 
 Test that renaming a largefile results in correct output for status
 


More information about the Mercurial-devel mailing list