You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by gs...@apache.org on 2010/04/09 07:55:32 UTC
svn commit: r932261 - /subversion/trunk/tools/dev/wc-ng/count-progress.py
Author: gstein
Date: Fri Apr 9 05:55:31 2010
New Revision: 932261
URL: http://svn.apache.org/viewvc?rev=932261&view=rev
Log:
Enable this script to run from the root of trunk
* tools/dev/wc-ng/count-progress.py:
(usage): new function, yanked from the __main__ logic
(__main__): call usage, as appropriate. if 'subversion' or 'tools' are
not in the current path, then see if ./subversion is present.
Modified:
subversion/trunk/tools/dev/wc-ng/count-progress.py
Modified: subversion/trunk/tools/dev/wc-ng/count-progress.py
URL: http://svn.apache.org/viewvc/subversion/trunk/tools/dev/wc-ng/count-progress.py?rev=932261&r1=932260&r2=932261&view=diff
==============================================================================
--- subversion/trunk/tools/dev/wc-ng/count-progress.py (original)
+++ subversion/trunk/tools/dev/wc-ng/count-progress.py Fri Apr 9 05:55:31 2010
@@ -78,10 +78,8 @@ def print_report(wcroot):
print(FMT % ('Total', client_total, wc_total, client_total + wc_total))
-if __name__ == '__main__':
- if len(sys.argv) > 1:
- if '--help' in sys.argv[1:]:
- print("""\
+def usage():
+ print("""\
Usage: %s [WCROOT]
%s --help
@@ -90,7 +88,15 @@ items in working copy branch root WCROOT
program will attempt to guess it using the assumption that it is being
run from within the working copy of interest."""
% (sys.argv[0], sys.argv[0]))
- sys.exit(0)
+
+ sys.exit(0)
+
+
+if __name__ == '__main__':
+ if len(sys.argv) > 1:
+ if '--help' in sys.argv[1:]:
+ usage()
+
print_report(sys.argv[1])
else:
cwd = os.path.abspath(os.getcwd())
@@ -101,6 +107,8 @@ run from within the working copy of inte
idx = cwd.rfind(os.sep + 'tools')
if idx > 0:
wcroot = cwd[:idx]
+ elif os.path.exists(os.path.join(cwd, 'subversion')):
+ wcroot = cwd
else:
print("ERROR: the root of 'trunk' cannot be located -- please provide")
sys.exit(1)