[PATCH 2 of 2 default] added regression test for issue 3857

Sean Farley sean.michael.farley at gmail.com
Fri Nov 29 13:19:46 CST 2013


sandeepcr2 at gmail.com writes:

> # HG changeset patch
> # User Sandeep.C.R <sandeepcr2 at 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 at 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.


More information about the Mercurial-devel mailing list