mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 10:41:31 +00:00
Support USERNAME as well as USER environment variable
my_activity.py tries to determine the current user with the USER environment variable but on Windows it should use USERNAME. This change gets it to check both, which saves users from having to use the -u option and figure out what format the name should be in. Change-Id: Id2458d29f8a2635a96dd3859d6af0ed5aaea22bf Reviewed-on: https://chromium-review.googlesource.com/c/1479896 Reviewed-by: Dirk Pranke <dpranke@chromium.org> Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
This commit is contained in:
@@ -857,7 +857,8 @@ def main():
|
||||
parser = optparse.OptionParser(description=sys.modules[__name__].__doc__)
|
||||
parser.add_option(
|
||||
'-u', '--user', metavar='<email>',
|
||||
default=os.environ.get('USER'),
|
||||
# Look for USER and USERNAME (Windows) environment variables.
|
||||
default=os.environ.get('USER', os.environ.get('USERNAME')),
|
||||
help='Filter on user, default=%default')
|
||||
parser.add_option(
|
||||
'-b', '--begin', metavar='<date>',
|
||||
@@ -1008,7 +1009,7 @@ def main():
|
||||
if args:
|
||||
parser.error('Args unsupported')
|
||||
if not options.user:
|
||||
parser.error('USER is not set, please use -u')
|
||||
parser.error('USER/USERNAME is not set, please use -u')
|
||||
options.user = username(options.user)
|
||||
|
||||
logging.basicConfig(level=options.verbosity)
|
||||
|
||||
Reference in New Issue
Block a user