开发者

Get file size in bazaar

How can I get the size of a versioned file/files? This seems to b开发者_如何学Ce a very common operation but I can't find how (Am I missing something?). Well, I can get it indirectly by catting it and count the bytes but this is very slow.

Any help would be appropriated.


You can't get information about file size from command-line but can get it with python, using bzrlib.

 import bzrlib
 from bzrlib import branch

 b = branch.Branch.open('.')
 b.lock_read()
 try:
     rt = b.repository.revision_tree(revision_id)
     fileid = rt.path2id('filename')
     if fileid is None:
         print 'file is not versioned!'
     else:
         print 'file size:', rt.get_file_size(fileid)
finally:
    b.unlock()
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜