Mercurial > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
18973:5f9019e6d451 | 18974:d78a136a8036 |
---|---|
528 lfdirstate.add(lfile) | 528 lfdirstate.add(lfile) |
529 elif state == '?': | 529 elif state == '?': |
530 lfdirstate.drop(lfile) | 530 lfdirstate.drop(lfile) |
531 return ret | 531 return ret |
532 | 532 |
533 def catlfile(repo, lfile, rev, filename): | |
534 hash = lfutil.readstandin(repo, lfile, rev) | |
535 if not lfutil.inusercache(repo.ui, hash): | |
536 store = basestore._openstore(repo) | |
537 success, missing = store.get([(lfile, hash)]) | |
538 if len(success) != 1: | |
539 raise util.Abort( | |
540 _('largefile %s is not in cache and could not be downloaded') | |
541 % lfile) | |
542 path = lfutil.usercachepath(repo.ui, hash) | |
543 fpout = cmdutil.makefileobj(repo, filename) | |
544 fpin = open(path, "rb") | |
545 for chunk in lfutil.blockstream(fpin): | |
546 fpout.write(chunk) | |
547 fpout.close() | |
548 fpin.close() | |
549 return 0 | |
550 | |
551 # -- hg commands declarations ------------------------------------------------ | 533 # -- hg commands declarations ------------------------------------------------ |
552 | 534 |
553 cmdtable = { | 535 cmdtable = { |
554 'lfconvert': (lfconvert, | 536 'lfconvert': (lfconvert, |
555 [('s', 'size', '', | 537 [('s', 'size', '', |