[PATCH evolve-ext] tests: update tests with default-date change

Boris Feld boris.feld at octobus.net
Fri May 26 11:17:26 EDT 2017


Hi Durham,

thank you for your patch.

I took a look at test-evolve.t because it shouldn't have changed just
because of the introduction of default-date.

>From what I understood, the failing part of the test (the hg metaedit
--config defaults.metaedit= call) is specifically testing for a
limitation of the metaedit command which is take the current date if no
date is given. The clues I get were:

- The test file is forcing the default date to "0 0" while this call
remove the defaults to not pass dates.
- The "TODO: don't create a new commit in this case" comment seems to
indicate that the expected (or better) behavior should be to avoid
creating a new changeset in case we don't edit any other meta.
- The code rewriting changesets had this comment: "date =
commitopts.get('date') or None # old.date()"

The fact that it suddenly worked is because I added the default-date to
epoch in mercurial test-runner.py. So the date ended up to be the same
(by chance). I proposed another patch that set default-date to another
value just for this call so we highlight the bug and have a stable
hash.

On Wed, 2017-05-24 at 10:12 -0700, Durham Goode wrote:
> # HG changeset patch
> # User Durham Goode <durham at fb.com>
> # Date 1495645611 25200
> #      Wed May 24 10:06:51 2017 -0700
> # Branch stable
> # Node ID e2d66ce467f3a8bd6a9a8ad58a7d7dbf0b1d6ff4
> # Parent  84982b441e82ac033ccb05a6543abb43223eeb4d
> tests: update tests with default-date change
> 
> 08d02c1d7e67df in core Mercurial enabled obsmarkers to use the
> specified default
> date, which changes the output of a number of mutable-history tests.
> This patch
> updates the output.
> 
> diff --git a/tests/test-evolve-obshistory.t b/tests/test-evolve-
> obshistory.t
> --- a/tests/test-evolve-obshistory.t
> +++ b/tests/test-evolve-obshistory.t
> @@ -57,7 +57,7 @@ Actual test
>    @  4ae3a4151de9 (3) A1
>    |
>    x  471f378eab4c (1) A0
> -       rewritten by test (*20*) as 4ae3a4151de9 (glob)
> +       rewritten by test (Thu Jan 01 00:00:00 1970 +0000) as
> 4ae3a4151de9
>    
>    $ hg olog 4ae3a4151de9 --no-graph -Tjson | python -m json.tool
>    [
> @@ -88,7 +88,7 @@ Actual test
>    ]
>    $ hg olog --hidden 471f378eab4c
>    x  471f378eab4c (1) A0
> -       rewritten by test (*20*) as 4ae3a4151de9 (glob)
> +       rewritten by test (Thu Jan 01 00:00:00 1970 +0000) as
> 4ae3a4151de9
>    
>    $ hg olog --hidden 471f378eab4c --no-graph -Tjson | python -m
> json.tool
>    [
> @@ -175,7 +175,7 @@ Actual test
>  
>    $ hg olog 'desc(B0)' --hidden
>    x  0dec01379d3b (2) B0
> -       pruned by test (*20*) (glob)
> +       pruned by test (Thu Jan 01 00:00:00 1970 +0000)
>    
>    $ hg olog 'desc(B0)' --hidden --no-graph -Tjson | python -m
> json.tool
>    [
> @@ -308,7 +308,7 @@ Actual test
>  Check that debugobshistory on splitted commit show both targets
>    $ hg olog 471597cad322 --hidden
>    x  471597cad322 (1) A0
> -       rewritten by test (*20*) as 337fec4d2edc, f257fde29c7a (glob)
> +       rewritten by test (Thu Jan 01 00:00:00 1970 +0000) as
> 337fec4d2edc, f257fde29c7a
>    
>    $ hg olog 471597cad322 --hidden --no-graph -Tjson | python -m
> json.tool
>    [
> @@ -338,7 +338,7 @@ the revision plus the splitted one
>    o  337fec4d2edc (2) A0
>    |
>    x  471597cad322 (1) A0
> -       rewritten by test (*20*) as 337fec4d2edc, f257fde29c7a (glob)
> +       rewritten by test (Thu Jan 01 00:00:00 1970 +0000) as
> 337fec4d2edc, f257fde29c7a
>    
>  Check that debugobshistory on the second successor after split show
>  the revision plus the splitted one
> @@ -346,7 +346,7 @@ the revision plus the splitted one
>    @  f257fde29c7a (3) A0
>    |
>    x  471597cad322 (1) A0
> -       rewritten by test (*20*) as 337fec4d2edc, f257fde29c7a (glob)
> +       rewritten by test (Thu Jan 01 00:00:00 1970 +0000) as
> 337fec4d2edc, f257fde29c7a
>    
>  Check that debugobshistory on both successors after split show
>  a coherent graph
> @@ -356,7 +356,7 @@ a coherent graph
>    | @  f257fde29c7a (3) A0
>    |/
>    x  471597cad322 (1) A0
> -       rewritten by test (*20*) as 337fec4d2edc, f257fde29c7a (glob)
> +       rewritten by test (Thu Jan 01 00:00:00 1970 +0000) as
> 337fec4d2edc, f257fde29c7a
>    
>    $ hg update 471597cad322
>    abort: hidden revision '471597cad322'!
> @@ -522,7 +522,7 @@ Actual test
>  
>    $ hg olog de7290d8b885 --hidden
>    x  de7290d8b885 (1) A0
> -       rewritten by test (*20*) as 1ae8bc733a14, 337fec4d2edc,
> c7f044602e9b, f257fde29c7a (glob)
> +       rewritten by test (Thu Jan 01 00:00:00 1970 +0000) as
> 1ae8bc733a14, 337fec4d2edc, c7f044602e9b, f257fde29c7a
>    
>    $ hg olog de7290d8b885 --hidden --no-graph -Tjson | python -m
> json.tool
>    [
> @@ -552,7 +552,7 @@ Actual test
>    @  c7f044602e9b (5) A0
>    |
>    x  de7290d8b885 (1) A0
> -       rewritten by test (*20*) as 1ae8bc733a14, 337fec4d2edc,
> c7f044602e9b, f257fde29c7a (glob)
> +       rewritten by test (Thu Jan 01 00:00:00 1970 +0000) as
> 1ae8bc733a14, 337fec4d2edc, c7f044602e9b, f257fde29c7a
>    
>    $ hg olog c7f044602e9b --no-graph -Tjson | python -m json.tool
>    [
> @@ -595,7 +595,7 @@ Check that debugobshistory on all heads 
>    | o  f257fde29c7a (3) A0
>    |/
>    x  de7290d8b885 (1) A0
> -       rewritten by test (*20*) as 1ae8bc733a14, 337fec4d2edc,
> c7f044602e9b, f257fde29c7a (glob)
> +       rewritten by test (Thu Jan 01 00:00:00 1970 +0000) as
> 1ae8bc733a14, 337fec4d2edc, c7f044602e9b, f257fde29c7a
>    
>    $ hg update de7290d8b885
>    abort: hidden revision 'de7290d8b885'!
> @@ -667,13 +667,13 @@ Check that debugobshistory on the first 
>  the revision with the target
>    $ hg olog --hidden 471f378eab4c
>    x  471f378eab4c (1) A0
> -       rewritten by test (*20*) as eb5a0daa2192 (glob)
> +       rewritten by test (Thu Jan 01 00:00:00 1970 +0000) as
> eb5a0daa2192
>    
>  Check that debugobshistory on the second folded revision show only
>  the revision with the target
>    $ hg olog --hidden 0dec01379d3b
>    x  0dec01379d3b (2) B0
> -       rewritten by test (*20*) as eb5a0daa2192 (glob)
> +       rewritten by test (Thu Jan 01 00:00:00 1970 +0000) as
> eb5a0daa2192
>    
>  Check that debugobshistory on the successor revision show a coherent
>  graph
> @@ -681,10 +681,10 @@ graph
>    @    eb5a0daa2192 (3) C0
>    |\
>    x |  0dec01379d3b (2) B0
> -   /     rewritten by test (*20*) as eb5a0daa2192 (glob)
> +   /     rewritten by test (Thu Jan 01 00:00:00 1970 +0000) as
> eb5a0daa2192
>    |
>    x  471f378eab4c (1) A0
> -       rewritten by test (*20*) as eb5a0daa2192 (glob)
> +       rewritten by test (Thu Jan 01 00:00:00 1970 +0000) as
> eb5a0daa2192
>    
>    $ hg olog eb5a0daa2192 --no-graph -Tjson | python -m json.tool
>    [
> @@ -817,8 +817,8 @@ Actual test
>  Check that debugobshistory on the divergent revision show both
> destinations
>    $ hg olog --hidden 471f378eab4c
>    x  471f378eab4c (1) A0
> -       rewritten by test (*20*) as 65b757b745b9 (glob)
> -       rewritten by test (*20*) as fdf9bde5129a (glob)
> +       rewritten by test (Thu Jan 01 00:00:00 1970 +0000) as
> 65b757b745b9
> +       rewritten by test (Thu Jan 01 00:00:00 1970 +0000) as
> fdf9bde5129a
>    
>    $ hg olog --hidden 471f378eab4c --no-graph -Tjson | python -m
> json.tool
>    [
> @@ -858,8 +858,8 @@ and the diverent one
>    o  fdf9bde5129a (2) A1
>    |
>    x  471f378eab4c (1) A0
> -       rewritten by test (*20*) as 65b757b745b9 (glob)
> -       rewritten by test (*20*) as fdf9bde5129a (glob)
> +       rewritten by test (Thu Jan 01 00:00:00 1970 +0000) as
> 65b757b745b9
> +       rewritten by test (Thu Jan 01 00:00:00 1970 +0000) as
> fdf9bde5129a
>    
>  Check that debugobshistory on the second diverged revision show the
> revision
>  and the diverent one
> @@ -867,8 +867,8 @@ and the diverent one
>    @  65b757b745b9 (3) A2
>    |
>    x  471f378eab4c (1) A0
> -       rewritten by test (*20*) as 65b757b745b9 (glob)
> -       rewritten by test (*20*) as fdf9bde5129a (glob)
> +       rewritten by test (Thu Jan 01 00:00:00 1970 +0000) as
> 65b757b745b9
> +       rewritten by test (Thu Jan 01 00:00:00 1970 +0000) as
> fdf9bde5129a
>    
>  Check that debugobshistory on the both diverged revision show a
> coherent
>  graph
> @@ -878,8 +878,8 @@ graph
>    | o  fdf9bde5129a (2) A1
>    |/
>    x  471f378eab4c (1) A0
> -       rewritten by test (*20*) as 65b757b745b9 (glob)
> -       rewritten by test (*20*) as fdf9bde5129a (glob)
> +       rewritten by test (Thu Jan 01 00:00:00 1970 +0000) as
> 65b757b745b9
> +       rewritten by test (Thu Jan 01 00:00:00 1970 +0000) as
> fdf9bde5129a
>    
>    $ hg olog '65b757b745b9+fdf9bde5129a' --no-graph -Tjson | python
> -m json.tool
>    [
> @@ -1009,13 +1009,13 @@ Check that debugobshistory on head show 
>    @    eb5a0daa2192 (4) C0
>    |\
>    x |  471f378eab4c (1) A0
> -   /     rewritten by test (*20*) as eb5a0daa2192 (glob)
> +   /     rewritten by test (Thu Jan 01 00:00:00 1970 +0000) as
> eb5a0daa2192
>    |
>    x  b7ea6d14e664 (3) B1
> -  |    rewritten by test (*20*) as eb5a0daa2192 (glob)
> +  |    rewritten by test (Thu Jan 01 00:00:00 1970 +0000) as
> eb5a0daa2192
>    |
>    x  0dec01379d3b (2) B0
> -       rewritten by test (*20*) as b7ea6d14e664 (glob)
> +       rewritten by test (Thu Jan 01 00:00:00 1970 +0000) as
> b7ea6d14e664
>    
>    $ hg olog eb5a0daa2192 --no-graph -Tjson | python -m json.tool
>    [
> @@ -1173,10 +1173,10 @@ Test setup
>    @  7a230b46bf61 (3) A2
>    |
>    x  fdf9bde5129a (2) A1
> -  |    rewritten by test (*20*) as 7a230b46bf61 (glob)
> +  |    rewritten by test (Thu Jan 01 00:00:00 1970 +0000) as
> 7a230b46bf61
>    |
>    x  471f378eab4c (1) A0
> -       rewritten by test (*20*) as fdf9bde5129a (glob)
> +       rewritten by test (Thu Jan 01 00:00:00 1970 +0000) as
> fdf9bde5129a
>    
>    $ cd $TESTTMP/local-remote-markers-2
>    $ hg pull
> @@ -1196,19 +1196,19 @@ changectx
>    o  7a230b46bf61 (2) A2
>    |
>    x  fdf9bde5129a
> -  |    rewritten by test (*20*) as 7a230b46bf61 (glob)
> +  |    rewritten by test (Thu Jan 01 00:00:00 1970 +0000) as
> 7a230b46bf61
>    |
>    @  471f378eab4c (1) A0
> -       rewritten by test (*20*) as fdf9bde5129a (glob)
> +       rewritten by test (Thu Jan 01 00:00:00 1970 +0000) as
> fdf9bde5129a
>    
>    $ hg olog 7a230b46bf61 --color=debug
>    o  [evolve.node|7a230b46bf61] [evolve.rev|(2)]
> [evolve.short_description|A2]
>    |
>    x  [evolve.node evolve.missing_change_ctx|fdf9bde5129a]
> -  |    [evolve.verb|rewritten] by [evolve.user|test]
> [evolve.date|(*20*)] as [evolve.node|7a230b46bf61] (glob)
> +  |    [evolve.verb|rewritten] by [evolve.user|test]
> [evolve.date|(Thu Jan 01 00:00:00 1970 +0000)] as
> [evolve.node|7a230b46bf61]
>    |
>    @  [evolve.node|471f378eab4c] [evolve.rev|(1)]
> [evolve.short_description|A0]
> -       [evolve.verb|rewritten] by [evolve.user|test]
> [evolve.date|(*20*)] as [evolve.node|fdf9bde5129a] (glob)
> +       [evolve.verb|rewritten] by [evolve.user|test]
> [evolve.date|(Thu Jan 01 00:00:00 1970 +0000)] as
> [evolve.node|fdf9bde5129a]
>    
>  
>  Test with cycle
> @@ -1284,35 +1284,35 @@ Check that debugobshistory never crash o
>  
>    $ hg olog "desc(A)" --hidden
>    @  2a34000d3544 (1) A
> -  |    rewritten by test (*20*) as c473644ee0e9 (glob)
> +  |    rewritten by test (Thu Jan 01 00:00:00 1970 +0000) as
> c473644ee0e9
>    |
>    x  a8df460dbbfe (3) C
> -  |    rewritten by test (*20*) as 2a34000d3544 (glob)
> +  |    rewritten by test (Thu Jan 01 00:00:00 1970 +0000) as
> 2a34000d3544
>    |
>    x  c473644ee0e9 (2) B
> -  |    rewritten by test (*20*) as a8df460dbbfe (glob)
> +  |    rewritten by test (Thu Jan 01 00:00:00 1970 +0000) as
> a8df460dbbfe
>    |
>  
>    $ hg olog "desc(B)" --hidden
>    @  2a34000d3544 (1) A
> -  |    rewritten by test (*20*) as c473644ee0e9 (glob)
> +  |    rewritten by test (Thu Jan 01 00:00:00 1970 +0000) as
> c473644ee0e9
>    |
>    x  a8df460dbbfe (3) C
> -  |    rewritten by test (*20*) as 2a34000d3544 (glob)
> +  |    rewritten by test (Thu Jan 01 00:00:00 1970 +0000) as
> 2a34000d3544
>    |
>    x  c473644ee0e9 (2) B
> -  |    rewritten by test (*20*) as a8df460dbbfe (glob)
> +  |    rewritten by test (Thu Jan 01 00:00:00 1970 +0000) as
> a8df460dbbfe
>    |
>  
>    $ hg olog "desc(C)" --hidden
>    @  2a34000d3544 (1) A
> -  |    rewritten by test (*20*) as c473644ee0e9 (glob)
> +  |    rewritten by test (Thu Jan 01 00:00:00 1970 +0000) as
> c473644ee0e9
>    |
>    x  a8df460dbbfe (3) C
> -  |    rewritten by test (*20*) as 2a34000d3544 (glob)
> +  |    rewritten by test (Thu Jan 01 00:00:00 1970 +0000) as
> 2a34000d3544
>    |
>    x  c473644ee0e9 (2) B
> -  |    rewritten by test (*20*) as a8df460dbbfe (glob)
> +  |    rewritten by test (Thu Jan 01 00:00:00 1970 +0000) as
> a8df460dbbfe
>    |
>  
>  Test with multiple cyles
> @@ -1428,22 +1428,22 @@ Check that debugobshistory never crash o
>  
>    $ hg olog "desc(D)" --hidden
>    x  0da815c333f6 (5) E
> -  |    rewritten by test (*20*) as d9f908fde1a1 (glob)
> +  |    rewritten by test (Thu Jan 01 00:00:00 1970 +0000) as
> d9f908fde1a1
>    |
>    @    868d2e0eb19c (4) D
> -  |\     rewritten by test (*20*) as 0da815c333f6 (glob)
> +  |\     rewritten by test (Thu Jan 01 00:00:00 1970 +0000) as
> 0da815c333f6
>    | |
>    | x  d9f908fde1a1 (6) F
> -  | |    rewritten by test (*20*) as 868d2e0eb19c (glob)
> +  | |    rewritten by test (Thu Jan 01 00:00:00 1970 +0000) as
> 868d2e0eb19c
>    | |
>    +---x  2a34000d3544 (1) A
> -  | |      rewritten by test (*20*) as c473644ee0e9 (glob)
> +  | |      rewritten by test (Thu Jan 01 00:00:00 1970 +0000) as
> c473644ee0e9
>    | |
>    x |  a8df460dbbfe (3) C
> -  | |    rewritten by test (*20*) as 2a34000d3544, 868d2e0eb19c
> (glob)
> +  | |    rewritten by test (Thu Jan 01 00:00:00 1970 +0000) as
> 2a34000d3544, 868d2e0eb19c
>    | |
>    x |  c473644ee0e9 (2) B
> -  | |    rewritten by test (*20*) as a8df460dbbfe (glob)
> +  | |    rewritten by test (Thu Jan 01 00:00:00 1970 +0000) as
> a8df460dbbfe
>    | |
>  
>  Check the json output is valid in this case
> diff --git a/tests/test-evolve.t b/tests/test-evolve.t
> --- a/tests/test-evolve.t
> +++ b/tests/test-evolve.t
> @@ -1586,26 +1586,25 @@ no new commit is created here because th
>    |
>    ~
>  
> -TODO: don't create a new commit in this case
> +don't create a new commit in this case
>    $ hg metaedit --config defaults.metaedit=
> -  0 files updated, 0 files merged, 0 files removed, 0 files
> unresolved
> +  nothing changed
>    $ hg log -r '.^::.' --template '{rev}: {desc|firstline}\n'
>    36: add uu
> -  45: amended
> +  44: amended
>  
>    $ hg up .^
>    2 files updated, 0 files merged, 0 files removed, 0 files
> unresolved
> -  $ hg metaedit --user foobar2 45
> +  $ hg metaedit --user foobar2 44
>    $ hg log --template '{rev}: {author}\n' -r '42:' --hidden
>    42: test
>    43: foobar
>    44: test
> -  45: test
> -  46: foobar2
> -  $ hg diff -r 45 -r 46 --hidden
> +  45: foobar2
> +  $ hg diff -r 44 -r 45 --hidden
>  
>  'fold' one commit
>    $ hg metaedit 39 --fold --user foobar3
>    1 changesets folded
> -  $ hg log -r 47 --template '{rev}: {author}\n'
> -  47: foobar3
> +  $ hg log -r 46 --template '{rev}: {author}\n'
> +  46: foobar3
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list