Show More
@@ -11,7 +11,7 b'' | |||||
11 | import os |
|
11 | import os | |
12 | import shutil |
|
12 | import shutil | |
13 |
|
13 | |||
14 | from mercurial import util, match as match_, hg, node, context, error |
|
14 | from mercurial import util, match as match_, hg, node, context, error, cmdutil | |
15 | from mercurial.i18n import _ |
|
15 | from mercurial.i18n import _ | |
16 |
|
16 | |||
17 | import lfutil |
|
17 | import lfutil | |
@@ -485,6 +485,23 b' def _updatelfile(repo, lfdirstate, lfile' | |||||
485 | lfdirstate.drop(lfile) |
|
485 | lfdirstate.drop(lfile) | |
486 | return ret |
|
486 | return ret | |
487 |
|
487 | |||
|
488 | def catlfile(repo, lfile, rev, filename): | |||
|
489 | hash = lfutil.readstandin(repo, lfile, rev) | |||
|
490 | if not lfutil.inusercache(repo.ui, hash): | |||
|
491 | store = basestore._openstore(repo) | |||
|
492 | success, missing = store.get([(lfile, hash)]) | |||
|
493 | if len(success) != 1: | |||
|
494 | raise util.Abort( | |||
|
495 | _('largefile %s is not in cache and could not be downloaded') | |||
|
496 | % lfile) | |||
|
497 | path = lfutil.usercachepath(repo.ui, hash) | |||
|
498 | fpout = cmdutil.makefileobj(repo, filename) | |||
|
499 | fpin = open(path, "rb") | |||
|
500 | fpout.write(fpin.read()) | |||
|
501 | fpout.close() | |||
|
502 | fpin.close() | |||
|
503 | return 0 | |||
|
504 | ||||
488 | # -- hg commands declarations ------------------------------------------------ |
|
505 | # -- hg commands declarations ------------------------------------------------ | |
489 |
|
506 | |||
490 | cmdtable = { |
|
507 | cmdtable = { |
@@ -966,3 +966,10 b' def overridetransplant(orig, ui, repo, *' | |||||
966 | finally: |
|
966 | finally: | |
967 | repo._istransplanting = False |
|
967 | repo._istransplanting = False | |
968 | return result |
|
968 | return result | |
|
969 | ||||
|
970 | def overridecat(orig, ui, repo, file1, *pats, **opts): | |||
|
971 | rev = opts.get('rev') | |||
|
972 | if not lfutil.standin(file1) in repo[rev]: | |||
|
973 | result = orig(ui, repo, file1, *pats, **opts) | |||
|
974 | return result | |||
|
975 | return lfcommands.catlfile(repo, file1, opts.get('rev'), opts.get('output')) |
@@ -64,6 +64,8 b' def uisetup(ui):' | |||||
64 | overrides.overrideupdate) |
|
64 | overrides.overrideupdate) | |
65 | entry = extensions.wrapcommand(commands.table, 'pull', |
|
65 | entry = extensions.wrapcommand(commands.table, 'pull', | |
66 | overrides.overridepull) |
|
66 | overrides.overridepull) | |
|
67 | entry = extensions.wrapcommand(commands.table, 'cat', | |||
|
68 | overrides.overridecat) | |||
67 | entry = extensions.wrapfunction(merge, '_checkunknownfile', |
|
69 | entry = extensions.wrapfunction(merge, '_checkunknownfile', | |
68 | overrides.overridecheckunknownfile) |
|
70 | overrides.overridecheckunknownfile) | |
69 | entry = extensions.wrapfunction(merge, 'manifestmerge', |
|
71 | entry = extensions.wrapfunction(merge, 'manifestmerge', |
@@ -761,6 +761,19 b' Test that transplanting a largefile chan' | |||||
761 | $ cat sub2/large7 |
|
761 | $ cat sub2/large7 | |
762 | large7 |
|
762 | large7 | |
763 |
|
763 | |||
|
764 | Cat a largefile | |||
|
765 | $ hg cat normal3 | |||
|
766 | normal3-modified | |||
|
767 | $ hg cat sub/large4 | |||
|
768 | large4-modified | |||
|
769 | $ rm ${USERCACHE}/* | |||
|
770 | $ hg cat -r a381d2c8c80e -o cat.out sub/large4 | |||
|
771 | $ cat cat.out | |||
|
772 | large4-modified | |||
|
773 | $ rm cat.out | |||
|
774 | $ hg cat -r a381d2c8c80e normal3 | |||
|
775 | normal3-modified | |||
|
776 | ||||
764 | Test that renaming a largefile results in correct output for status |
|
777 | Test that renaming a largefile results in correct output for status | |
765 |
|
778 | |||
766 | $ hg rename sub/large4 large4-renamed |
|
779 | $ hg rename sub/large4 large4-renamed |
General Comments 0
You need to be logged in to leave comments.
Login now