diff options
Diffstat (limited to 'Documentation/gen_commands.py')
-rwxr-xr-x | Documentation/gen_commands.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Documentation/gen_commands.py b/Documentation/gen_commands.py index d3db350bf7..eadea9e189 100755 --- a/Documentation/gen_commands.py +++ b/Documentation/gen_commands.py @@ -4,6 +4,7 @@ import errno import os import re import sys +import hashlib from collections import defaultdict from pprint import pprint @@ -169,5 +170,18 @@ for name, cmd in CMDS.items(): else: raise target = os.path.join(subdir, name+'.rst') + + # Only write the new rst if it differs from the old one. Wroto + hash_old = hashlib.sha1() + try: + f = open(target, 'rb') + hash_old.update(f.read()) + except: + pass + hash_new = hashlib.sha1() + hash_new.update(rst) + if hash_old.hexdigest() == hash_new.hexdigest(): + continue + file(target, 'w').write(rst) |