← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~jelmer/lp-dev-utils/loc-contributions-author into lp:lp-dev-utils

 

Jelmer Vernooij has proposed merging lp:~jelmer/lp-dev-utils/loc-contributions-author into lp:lp-dev-utils with lp:~cjwatson/lp-dev-utils/loc-delta as a prerequisite.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~jelmer/lp-dev-utils/loc-contributions-author/+merge/106145

Default to the current users' email address in loc-contributions, since usually you're looking at your own LOC stats.
-- 
https://code.launchpad.net/~jelmer/lp-dev-utils/loc-contributions-author/+merge/106145
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jelmer/lp-dev-utils/loc-contributions-author into lp:lp-dev-utils.
=== modified file 'loc-contributions'
--- loc-contributions	2012-05-17 11:49:18 +0000
+++ loc-contributions	2012-05-17 11:49:18 +0000
@@ -54,8 +54,9 @@
                 return
 
 
-def show_loc(options, author):
+def show_loc(options, author=None):
     branch = Branch.open(".")
+    author = branch.get_config_stack().get('email')
     logger = log.Logger(branch, {
         "direction": "forward",
         "start_revision": options.start_rev,
@@ -108,7 +109,7 @@
 
 
 def main(args):
-    usage = "%prog [options] AUTHOR"
+    usage = "%prog [options] [AUTHOR]"
     description = dedent("""\
         Show contributions to lines-of-code count by a given author.
 
@@ -122,10 +123,14 @@
     parser.add_option("--verbose", action="store_true", default=False,
                       help="Show detailed information about each revision.")
     options, args = parser.parse_args(args)
-    if len(args) != 1:
-        parser.error("must select an author")
+    if len(args) > 1:
+        parser.error("must select only one author")
+    elif len(args) == 1:
+        author = args[0]
+    else:
+        author = None
 
-    show_loc(options, args[0])
+    show_loc(options, author)
 
     return 0