changeset 17446:3de04c07966a

record: checks for valid username before starting recording process (issue3456)
author Sumeet <sumeet@fb.com>
date Mon, 27 Aug 2012 12:41:10 -0700
parents e5422a9ffe9d
children 29c100b42f5b
files hgext/record.py tests/test-record.t
diffstat 2 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/record.py	Wed Sep 05 14:08:31 2012 +0200
+++ b/hgext/record.py	Mon Aug 27 12:41:10 2012 -0700
@@ -496,6 +496,9 @@
         raise util.Abort(_('running non-interactively, use %s instead') %
                          cmdsuggest)
 
+    # make sure username is set before going interactive
+    ui.username()
+
     def recordfunc(ui, repo, message, match, opts):
         """This is generic record driver.
 
--- a/tests/test-record.t	Wed Sep 05 14:08:31 2012 +0200
+++ b/tests/test-record.t	Mon Aug 27 12:41:10 2012 -0700
@@ -246,10 +246,19 @@
   +9
   +10
   
+Modify end of plain file with username unset
+
+  $ echo 11 >> plain
+  $ unset HGUSER
+  $ hg record --config ui.username= -d '8 0' -m end plain
+  abort: no username supplied (see "hg help config")
+  [255]
+
 
 Modify end of plain file
 
-  $ echo 11 >> plain
+  $ HGUSER="test"
+  $ export HGUSER
   $ hg record -d '8 0' -m end plain <<EOF
   > y
   > y