Last change
on this file since 12603 was 12257, checked in by stoecker, 7 years ago |
see #14832 - add access to raw logo information
|
-
Property svn:executable
set to
*
|
File size:
1.3 KB
|
Line | |
---|
1 | #!/usr/bin/python
|
---|
2 | # License: CC0
|
---|
3 |
|
---|
4 | """
|
---|
5 | Helper script to replace "@since xxx" in Javadoc by the upcoming revision number.
|
---|
6 |
|
---|
7 | Will retrieve the current revision number from the server. It runs over all
|
---|
8 | modified and added .java files and replaces xxx in "@since xxx" by the revision
|
---|
9 | number that is to be expected for the next commit.
|
---|
10 | """
|
---|
11 |
|
---|
12 | import xml.etree.ElementTree as ElementTree
|
---|
13 | import subprocess
|
---|
14 |
|
---|
15 | svn_info_local = subprocess.check_output("svn info --xml".split(" "))
|
---|
16 | rep_url = ElementTree.fromstring(svn_info_local).findtext("./entry/repository/root")
|
---|
17 | svn_info_server = subprocess.check_output("svn info --xml".split(" ") + [rep_url])
|
---|
18 | rev = int(ElementTree.fromstring(svn_info_server).find("./entry").get("revision")) + 1
|
---|
19 | svn_status = subprocess.check_output("svn status --xml".split(" "))
|
---|
20 | for el in ElementTree.fromstring(svn_status).findall("./target/entry"):
|
---|
21 | if el.find('wc-status').get("item") not in ["added", "modified"]:
|
---|
22 | continue
|
---|
23 | path = el.get("path")
|
---|
24 | if not path.endswith('.java'):
|
---|
25 | continue
|
---|
26 | with open(path, 'r') as f:
|
---|
27 | filedata = f.read()
|
---|
28 | filedata2 = filedata.replace("@since xxx", "@since {}".format(rev))
|
---|
29 | if filedata != filedata2:
|
---|
30 | print("replacing '@since xxx' with '@since {}' in '{}'".format(rev, path))
|
---|
31 | with open(path, 'w') as f:
|
---|
32 | f.write(filedata2)
|
---|
33 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.