本文整理匯總了Python中box.Box.addVersion方法的典型用法代碼示例。如果您正苦於以下問題:Python Box.addVersion方法的具體用法?Python Box.addVersion怎麽用?Python Box.addVersion使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類box.Box
的用法示例。
在下文中一共展示了Box.addVersion方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: checkin
# 需要導入模塊: from box import Box [as 別名]
# 或者: from box.Box import addVersion [as 別名]
def checkin(url, files, message=None):
"""Check in files to a repository"""
from box import Box
b = Box(url)
if b.type != 'local':
raise BoxError('Not a box: %s' % url)
if not files:
raise BoxError('No files')
def _write(path):
log.debug('writing: %s' % path)
item = Item.from_path(repo=b, path=path)
v.addItem(item=item)
v = b.addVersion()
count = 1
total = len(files)
while count <= total:
print '[%s/%s] %0.2f%%' %(count, total, (float(count) / total) * 100), '*'*count, '\r',
_write(os.path.abspath(files[count-1]))
count += 1
sys.stdout.flush()
v.save(message=message)
print
示例2: Box
# 需要導入模塊: from box import Box [as 別名]
# 或者: from box.Box import addVersion [as 別名]
#!/usr/bin/env python
from box import Box, Item
# create new box
# create new version
b = Box('/tmp/foo')
v = b.addVersion()
# add new item to version and save
i = Item.from_path(b, '/Users/rsgalloway/Desktop/snow.jpg')
v.addItems([i])
print v.items()
print v.tree
v.save('teesting add version, adding snow.jpg')
print v.tree
print b.items()
print v.versions(-1).tree
# inherit items from parents