tests/test-contrib-dumprevlog.t
author Manuel Jacob <me@manueljacob.de>
Mon, 29 Jun 2020 15:03:36 +0200
branchstable
changeset 45022 e3b19004087a
parent 39707 5abc47d4ca6b
child 49825 2f2682f40ea0
permissions -rw-r--r--
convert: correctly convert paths to UTF-8 for Subversion The previous code using encoding.tolocal() only worked by chance in these situations: * The string is ASCII: The fast path was triggered and the string was returned unmodified. * The local encoding is UTF-8: The source and target encoding is the same. * The string is not valid UTF-8 and the native encoding is ISO-8859-1: If the string doesn’t decode using UTF-8, ISO-8859-1 is tried as a fallback. During `hg convert`, the local encoding is always UTF-8. The irony is that in this case, encoding.tolocal() behaves like what someone would expect the reverse function, encoding.fromlocal(), to do. When the locale encoding is ISO-8859-15, trying to convert a SVN repo `/tmp/a€` failed before like this: file:///tmp/a%C2%A4 does not look like a Subversion repository to libsvn version 1.14.0 The correct URL is `file:///tmp/a%E2%82%AC`. Unlike previously (with the ISO-8859-1 fallback), decoding the path using the locale encoding can fail. In this case, we have to bail out, as Subversion won’t be able to do anything useful with the path.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
37407
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     1
#require reporevlogstore
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     2
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     3
  $ CONTRIBDIR="$TESTDIR/../contrib"
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     4
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     5
  $ hg init repo-a
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     6
  $ cd repo-a
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     7
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     8
  $ echo this is file a > a
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     9
  $ hg add a
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    10
  $ hg commit -m first
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    11
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    12
  $ echo adding to file a >> a
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    13
  $ hg commit -m second
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    14
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    15
  $ echo adding more to file a >> a
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    16
  $ hg commit -m third
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    17
  $ hg verify
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    18
  checking changesets
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    19
  checking manifests
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    20
  crosschecking files in changesets and manifests
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    21
  checking files
39489
f1186c292d03 verify: make output less confusing (issue5924)
Meirambek Omyrzak <meirambek77@gmail.com>
parents: 37407
diff changeset
    22
  checked 3 changesets with 3 changes to 1 files
37407
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    23
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    24
Dumping revlog of file a to stdout:
39707
5abc47d4ca6b tests: quote PYTHON usage
Matt Harbison <matt_harbison@yahoo.com>
parents: 39489
diff changeset
    25
  $ "$PYTHON" "$CONTRIBDIR/dumprevlog" .hg/store/data/a.i
37407
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    26
  file: .hg/store/data/a.i
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    27
  node: 183d2312b35066fb6b3b449b84efc370d50993d0
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    28
  linkrev: 0
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    29
  parents: 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    30
  length: 15
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    31
  -start-
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    32
  this is file a
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    33
  
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    34
  -end-
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    35
  node: b1047953b6e6b633c0d8197eaa5116fbdfd3095b
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    36
  linkrev: 1
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    37
  parents: 183d2312b35066fb6b3b449b84efc370d50993d0 0000000000000000000000000000000000000000
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    38
  length: 32
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    39
  -start-
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    40
  this is file a
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    41
  adding to file a
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    42
  
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    43
  -end-
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    44
  node: 8c4fd1f7129b8cdec6c7f58bf48fb5237a4030c1
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    45
  linkrev: 2
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    46
  parents: b1047953b6e6b633c0d8197eaa5116fbdfd3095b 0000000000000000000000000000000000000000
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    47
  length: 54
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    48
  -start-
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    49
  this is file a
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    50
  adding to file a
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    51
  adding more to file a
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    52
  
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    53
  -end-
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    54
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    55
Dump all revlogs to file repo.dump:
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    56
39707
5abc47d4ca6b tests: quote PYTHON usage
Matt Harbison <matt_harbison@yahoo.com>
parents: 39489
diff changeset
    57
  $ find .hg/store -name "*.i" | sort | xargs "$PYTHON" "$CONTRIBDIR/dumprevlog" > ../repo.dump
37407
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    58
  $ cd ..
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    59
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    60
Undumping into repo-b:
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    61
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    62
  $ hg init repo-b
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    63
  $ cd repo-b
39707
5abc47d4ca6b tests: quote PYTHON usage
Matt Harbison <matt_harbison@yahoo.com>
parents: 39489
diff changeset
    64
  $ "$PYTHON" "$CONTRIBDIR/undumprevlog" < ../repo.dump
37407
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    65
  .hg/store/00changelog.i
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    66
  .hg/store/00manifest.i
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    67
  .hg/store/data/a.i
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    68
  $ cd ..
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    69
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    70
Rebuild fncache with clone --pull:
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    71
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    72
  $ hg clone --pull -U repo-b repo-c
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    73
  requesting all changes
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    74
  adding changesets
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    75
  adding manifests
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    76
  adding file changes
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    77
  added 3 changesets with 3 changes to 1 files
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    78
  new changesets de1da620e7d8:46946d278c50
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    79
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    80
Verify:
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    81
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    82
  $ hg -R repo-c verify
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    83
  checking changesets
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    84
  checking manifests
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    85
  crosschecking files in changesets and manifests
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    86
  checking files
39489
f1186c292d03 verify: make output less confusing (issue5924)
Meirambek Omyrzak <meirambek77@gmail.com>
parents: 37407
diff changeset
    87
  checked 3 changesets with 3 changes to 1 files
37407
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    88
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    89
Compare repos:
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    90
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    91
  $ hg -R repo-c incoming repo-a
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    92
  comparing with repo-a
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    93
  searching for changes
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    94
  no changes found
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    95
  [1]
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    96
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    97
  $ hg -R repo-a incoming repo-c
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    98
  comparing with repo-c
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    99
  searching for changes
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   100
  no changes found
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   101
  [1]