Patchwork [2,of,2,default] added regression test for issue 3857

login
register
mail settings
Submitter Sandeep.C.R
Date Nov. 29, 2013, 2:41 a.m.
Message ID <f5a836625f880a40fcf9.1385692903@localhost.localdomain>
Download mbox | patch
Permalink /patch/3190/
State Superseded
Headers show

Comments

Sandeep.C.R - Nov. 29, 2013, 2:41 a.m.
# HG changeset patch
# User Sandeep.C.R <sandeepcr2@gmail.com>
# Date 1385643827 -19800
# Node ID f5a836625f880a40fcf95ae37086f45bdf45b530
# Parent  be674fae4c5200453f9ce5139333239caf70968e
added regression test for issue 3857
Sean Farley - Nov. 29, 2013, 7:19 p.m.
sandeepcr2@gmail.com writes:

> # HG changeset patch
> # User Sandeep.C.R <sandeepcr2@gmail.com>
> # Date 1385643827 -19800
> # Node ID f5a836625f880a40fcf95ae37086f45bdf45b530
> # Parent  be674fae4c5200453f9ce5139333239caf70968e
> added regression test for issue 3857

I would say this should be folded into the previous patch and the last
part of the commit message could read: "Tests have been added," or
something similar.

Also, the bugtracker needs the format of the issue number to be
"(issue3857)" without the quotes.

> diff -r be674fae4c52 -r f5a836625f88 tests/test-record.t
> --- a/tests/test-record.t	Wed Nov 27 20:56:48 2013 +0530
> +++ b/tests/test-record.t	Thu Nov 28 18:33:47 2013 +0530
> @@ -1277,5 +1277,20 @@
>     c
>    +d
>    
> -
> +Take username from -u option
> + 
> +  $ unset HGUSER
> +  $ unset EMAIL
> +  $ touch  canrecordwithoutusername
> +  $ echo dummycontent > canrecordwithoutusername
> +  $ hg add canrecordwithoutusername
> +  $ hg record -m message -u recordinguser <<EOF
> +  > Y
> +  > Y
> +  > EOF
> +  diff --git a/canrecordwithoutusername b/canrecordwithoutusername
> +  new file mode 100644
> +  examine changes to 'canrecordwithoutusername'? [Ynesfdaq?] 
> +  $ EMAIL="Foo Bar <foo.bar@example.com>"
> +  $ export EMAIL
>    $ cd ..

This tests that there won't be a crash (which is good) but not that
'recorduser' is the actual user?

Stepping back, it seems to me that record should cache the username via
something like 'username = ui.username()' and that ui.username should
not crash?

Looking at the source of ui.py this might be more refactoring than is
necessary so you instead do:

# always prefer commandline option over environment variables
username = opts.get('user')
if not username:
    username = ui.username()

but I haven't tested this at all.

Patch

diff -r be674fae4c52 -r f5a836625f88 tests/test-record.t
--- a/tests/test-record.t	Wed Nov 27 20:56:48 2013 +0530
+++ b/tests/test-record.t	Thu Nov 28 18:33:47 2013 +0530
@@ -1277,5 +1277,20 @@ 
    c
   +d
   
-
+Take username from -u option
+ 
+  $ unset HGUSER
+  $ unset EMAIL
+  $ touch  canrecordwithoutusername
+  $ echo dummycontent > canrecordwithoutusername
+  $ hg add canrecordwithoutusername
+  $ hg record -m message -u recordinguser <<EOF
+  > Y
+  > Y
+  > EOF
+  diff --git a/canrecordwithoutusername b/canrecordwithoutusername
+  new file mode 100644
+  examine changes to 'canrecordwithoutusername'? [Ynesfdaq?] 
+  $ EMAIL="Foo Bar <foo.bar@example.com>"
+  $ export EMAIL
   $ cd ..