tests/test-convert-hg-sink.t
author Siddharth Agarwal <sid0@fb.com>
Fri, 18 Jan 2013 15:55:16 -0800
changeset 18442 ecba9b0e7672
parent 12525 81bf25ddd76a
child 19892 77872b002e73
permissions -rw-r--r--
posix: don't compare atime when determining if a file has changed A file's atime might change even if the file itself doesn't change. This might cause us to invalidate caches more often than necessary. Before this change, hg add often resulted in the dirstate being parsed twice on systems that track atime. After this change, it is only parsed once. For a repository with over 180,000 files, this speeds up hg add from 1.2 seconds to 1.0.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5278
70e9a527cc61 convert: avoid dirstate checks; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     1
12525
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
     2
  $ cat >> $HGRCPATH <<EOF
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
     3
  > [extensions]
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
     4
  > convert=
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
     5
  > [convert]
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
     6
  > hg.saverev=False
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
     7
  > EOF
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
     8
  $ hg init orig
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
     9
  $ cd orig
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    10
  $ echo foo > foo
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    11
  $ echo bar > bar
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    12
  $ hg ci -qAm 'add foo and bar'
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    13
  $ hg rm foo
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    14
  $ hg ci -m 'remove foo'
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    15
  $ mkdir foo
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    16
  $ echo file > foo/file
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    17
  $ hg ci -qAm 'add foo/file'
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    18
  $ hg tag some-tag
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    19
  $ hg log
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    20
  changeset:   3:593cbf6fb2b4
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    21
  tag:         tip
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    22
  user:        test
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    23
  date:        Thu Jan 01 00:00:00 1970 +0000
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    24
  summary:     Added tag some-tag for changeset ad681a868e44
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    25
  
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    26
  changeset:   2:ad681a868e44
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    27
  tag:         some-tag
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    28
  user:        test
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    29
  date:        Thu Jan 01 00:00:00 1970 +0000
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    30
  summary:     add foo/file
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    31
  
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    32
  changeset:   1:cbba8ecc03b7
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    33
  user:        test
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    34
  date:        Thu Jan 01 00:00:00 1970 +0000
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    35
  summary:     remove foo
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    36
  
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    37
  changeset:   0:327daa9251fa
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    38
  user:        test
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    39
  date:        Thu Jan 01 00:00:00 1970 +0000
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    40
  summary:     add foo and bar
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    41
  
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    42
  $ cd ..
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    43
  $ hg convert orig new 2>&1 | grep -v 'subversion python bindings could not be loaded'
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    44
  initializing destination new repository
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    45
  scanning source...
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    46
  sorting...
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    47
  converting...
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    48
  3 add foo and bar
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    49
  2 remove foo
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    50
  1 add foo/file
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    51
  0 Added tag some-tag for changeset ad681a868e44
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    52
  $ cd new
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    53
  $ hg out ../orig
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    54
  comparing with ../orig
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    55
  searching for changes
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    56
  no changes found
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    57
  [1]
5278
70e9a527cc61 convert: avoid dirstate checks; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    58
12525
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    59
dirstate should be empty:
5279
2dbd750b3ddd convert: clear the dirstate before a conversion, invalidate it afterwards
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5278
diff changeset
    60
12525
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    61
  $ hg debugstate
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    62
  $ hg parents -q
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    63
  $ hg up -C
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    64
  3 files updated, 0 files merged, 0 files removed, 0 files unresolved
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    65
  $ hg copy bar baz
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    66
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    67
put something in the dirstate:
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    68
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    69
  $ hg debugstate > debugstate
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    70
  $ grep baz debugstate
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    71
  a   0         -1 unset               baz
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    72
  copy: bar -> baz
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    73
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    74
add a new revision in the original repo
5279
2dbd750b3ddd convert: clear the dirstate before a conversion, invalidate it afterwards
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5278
diff changeset
    75
12525
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    76
  $ cd ../orig
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    77
  $ echo baz > baz
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    78
  $ hg ci -qAm 'add baz'
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    79
  $ cd ..
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    80
  $ hg convert orig new 2>&1 | grep -v 'subversion python bindings could not be loaded'
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    81
  scanning source...
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    82
  sorting...
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    83
  converting...
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    84
  0 add baz
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    85
  $ cd new
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    86
  $ hg out ../orig
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    87
  comparing with ../orig
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    88
  searching for changes
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    89
  no changes found
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    90
  [1]
5279
2dbd750b3ddd convert: clear the dirstate before a conversion, invalidate it afterwards
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5278
diff changeset
    91
12525
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    92
dirstate should be the same (no output below):
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    93
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    94
  $ hg debugstate > new-debugstate
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    95
  $ diff debugstate new-debugstate
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    96
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    97
no copies
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    98
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    99
  $ hg up -C
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
   100
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
   101
  $ hg debugrename baz
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
   102
  baz not renamed
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
   103
  $ cd ..
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
   104
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
   105
test tag rewriting
5279
2dbd750b3ddd convert: clear the dirstate before a conversion, invalidate it afterwards
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5278
diff changeset
   106
12525
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
   107
  $ cat > filemap <<EOF
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
   108
  > exclude foo
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
   109
  > EOF
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
   110
  $ hg convert --filemap filemap orig new-filemap 2>&1 | grep -v 'subversion python bindings could not be loaded'
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
   111
  initializing destination new-filemap repository
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
   112
  scanning source...
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
   113
  sorting...
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
   114
  converting...
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
   115
  4 add foo and bar
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
   116
  3 remove foo
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
   117
  2 add foo/file
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
   118
  1 Added tag some-tag for changeset ad681a868e44
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
   119
  0 add baz
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
   120
  $ cd new-filemap
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
   121
  $ hg tags
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
   122
  tip                                2:6f4fd1df87fb
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
   123
  some-tag                           0:ba8636729451
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
   124
  $ cd ..