r79370 - pyrepl/trunk/pyrepl
[email protected] Mon, 22 Nov 2010 23:54:09 +0100 (CET)
| Newsgroups | gmane.comp.python.pyrepl.checkins |
|---|---|
| Message-ID | <[email protected]> |
Author: mwh Date: Mon Nov 22 23:54:08 2010 New Revision: 79370 Modified: pyrepl/trunk/pyrepl/encopyright.py Log: hack on encopyright.py to go by modification date of file Modified: pyrepl/trunk/pyrepl/encopyright.py ============================================================================== --- pyrepl/trunk/pyrepl/encopyright.py (original) +++ pyrepl/trunk/pyrepl/encopyright.py Mon Nov 22 23:54:08 2010 @@ -20,9 +20,10 @@ # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. import os, time, sys +import bzrlib.branch -header = """\ -# Copyright 2000-%s Michael Hudson-Doyle [email protected] +header_template = """\ +# Copyright 2000-%s Michael Hudson-Doyle <[email protected]> # # All Rights Reserved # @@ -40,9 +41,14 @@ # RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF # CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\ -"""%(time.localtime()[0]) +""" + +branch, path = bzrlib.branch.Branch.open_containing(sys.argv[0]) +rev_tree = branch.basis_tree() +branch.lock_read() +print rev_tree +#sys.exit(0) -header_lines = header.split("\n") def process(thing): if os.path.isdir(thing): @@ -56,6 +62,10 @@ def process_file(file): ilines = open(file).readlines() + last_modified = rev_tree.get_file_mtime(rev_tree.path2id(file)) + modified_year = time.gmtime(last_modified)[0] + header = header_template % (modified_year, ) + header_lines = header.splitlines() prelines = [] old_copyright = [] @@ -64,7 +74,6 @@ return i = 0 - diff = 0 if ilines[0][:2] == '#!': prelines.append(ilines[0])