#!/usr/bin/env python
import commands
import sys
import os
# Get the revision number of the most recent tagged commit.
tags = commands.getoutput("bzr tags --sort=time")
latest = tags.split()[-1]
target = sys.argv[-1]
if not os.path.isfile(target):
print "Error, no such file: '"+target+"'"
sys.exit(1)
print commands.getoutput("bzr diff "+target+" -r "+latest)
用法:
python diff-from-tagged.py test
输出:
=== modified file 'test'
--- test 2011-01-08 19:20:31 +0000
+++ test 2011-01-08 20:00:12 +0000
@@ -1,1 +1,2 @@
dfsafd
+The quick brown fox
这样的事情应该可以解决问题:
用法:
输出: