本文整理汇总了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