mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 23:38:50 +03:00
record: --user/-u now works with record when ui.username not set (issue3857)
The -u flag didn't work when ui.username was not set and resulted in an abort message. This was fixed by checking for the 'user' key in the opts dictionary. If the key is present, the step causing the exception is not executed.
This commit is contained in:
parent
3de6d4f403
commit
7c782e5502
@ -502,7 +502,8 @@ def dorecord(ui, repo, commitfunc, cmdsuggest, backupall, *pats, **opts):
|
||||
cmdsuggest)
|
||||
|
||||
# make sure username is set before going interactive
|
||||
ui.username()
|
||||
if not opts.get('user'):
|
||||
ui.username() # raise exception, username not provided
|
||||
|
||||
def recordfunc(ui, repo, message, match, opts):
|
||||
"""This is generic record driver.
|
||||
|
@ -1277,5 +1277,25 @@ Ignore win32text deprecation warning for now:
|
||||
c
|
||||
+d
|
||||
|
||||
Test --user when ui.username not set
|
||||
$ unset HGUSER
|
||||
$ echo e >> subdir/f1
|
||||
$ hg record --config ui.username= -d '8 0' --user xyz -m "user flag" <<EOF
|
||||
> y
|
||||
> y
|
||||
> EOF
|
||||
diff --git a/subdir/f1 b/subdir/f1
|
||||
1 hunks, 1 lines changed
|
||||
examine changes to 'subdir/f1'? [Ynesfdaq?]
|
||||
@@ -4,3 +4,4 @@
|
||||
b
|
||||
c
|
||||
d
|
||||
+e
|
||||
record this change to 'subdir/f1'? [Ynesfdaq?]
|
||||
$ hg log --template '{author}\n' -l 1
|
||||
xyz
|
||||
$ HGUSER="test"
|
||||
$ export HGUSER
|
||||
|
||||
$ cd ..
|
||||
|
Loading…
Reference in New Issue
Block a user