tests/test-children.t
author Mads Kiilerich <madski@unity3d.com>
Fri, 09 Jan 2015 18:38:02 +0100
changeset 23840 ddc17eaf0f1b
parent 16913 f2719b387380
child 24482 3eb9045396b0
permissions -rw-r--r--
debugdirstate: don't hide date field with --nodate, just show 'set'/'unset' The value of the dirstate date field cannot be used in tests and we thus have to use debugdirstate with --nodate. It is however still very helpful to be able to see whether the date field has been set or still is unset. The absence of that information made it hard to debug some largefile dirstate issues. This change _could_ make the test suite more unstable ... but that would be places where the test suite or the code should be made more stable. (Note: 'unset' with the magic negative sizes is reliable. 'unset' for normal sizes would probably not be reliable, but there is no such occurrences in the test suite and it should thus be reliable.) This output wastes more horizontal space in the --nodate output, but it also makes things simpler that the output format always is the same. It is just a debug command so let's keep it simple.

test children command

  $ cat <<EOF >> $HGRCPATH
  > [extensions]
  > children =
  > EOF

init
  $ hg init t
  $ cd t

no working directory
  $ hg children

setup
  $ echo 0 > file0
  $ hg ci -qAm 0 -d '0 0'

  $ echo 1 > file1
  $ hg ci -qAm 1 -d '1 0'

  $ echo 2 >> file0
  $ hg ci -qAm 2 -d '2 0'

  $ hg co null
  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
  $ echo 3 > file3
  $ hg ci -qAm 3 -d '3 0'

hg children at revision 3 (tip)
  $ hg children

  $ hg co null
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved

hg children at nullrev (should be 0 and 3)
  $ hg children
  changeset:   0:4df8521a7374
  user:        test
  date:        Thu Jan 01 00:00:00 1970 +0000
  summary:     0
  
  changeset:   3:e2962852269d
  tag:         tip
  parent:      -1:000000000000
  user:        test
  date:        Thu Jan 01 00:00:03 1970 +0000
  summary:     3
  
  $ hg co 1
  2 files updated, 0 files merged, 0 files removed, 0 files unresolved

hg children at revision 1 (should be 2)
  $ hg children
  changeset:   2:8f5eea5023c2
  user:        test
  date:        Thu Jan 01 00:00:02 1970 +0000
  summary:     2
  
  $ hg co 2
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved

hg children at revision 2 (other head)
  $ hg children

  $ for i in null 0 1 2 3; do
  > echo "hg children -r $i"
  > hg children -r $i
  > done
  hg children -r null
  changeset:   0:4df8521a7374
  user:        test
  date:        Thu Jan 01 00:00:00 1970 +0000
  summary:     0
  
  changeset:   3:e2962852269d
  tag:         tip
  parent:      -1:000000000000
  user:        test
  date:        Thu Jan 01 00:00:03 1970 +0000
  summary:     3
  
  hg children -r 0
  changeset:   1:708c093edef0
  user:        test
  date:        Thu Jan 01 00:00:01 1970 +0000
  summary:     1
  
  hg children -r 1
  changeset:   2:8f5eea5023c2
  user:        test
  date:        Thu Jan 01 00:00:02 1970 +0000
  summary:     2
  
  hg children -r 2
  hg children -r 3

hg children -r 0 file0 (should be 2)
  $ hg children -r 0 file0
  changeset:   2:8f5eea5023c2
  user:        test
  date:        Thu Jan 01 00:00:02 1970 +0000
  summary:     2
  

hg children -r 1 file0 (should be 2)
  $ hg children -r 1 file0
  changeset:   2:8f5eea5023c2
  user:        test
  date:        Thu Jan 01 00:00:02 1970 +0000
  summary:     2
  

  $ hg co 0
  1 files updated, 0 files merged, 1 files removed, 0 files unresolved

hg children file0 at revision 0 (should be 2)
  $ hg children file0
  changeset:   2:8f5eea5023c2
  user:        test
  date:        Thu Jan 01 00:00:02 1970 +0000
  summary:     2
  

  $ cd ..