test-rhg.t 2.91 KB
Newer Older
1
2
#require rust

3
Define an rhg function that will only run if rhg exists
4
5
6
7
8
9
10
11
  $ rhg() {
  > if [ -f "$RUNTESTDIR/../rust/target/debug/rhg" ]; then
  >   "$RUNTESTDIR/../rust/target/debug/rhg" "$@"
  > else
  >   echo "skipped: Cannot find rhg. Try to run cargo build in rust/rhg."
  >   exit 80
  > fi
  > }
12
13

Unimplemented command
14
  $ rhg unimplemented-command
15
16
17
18
19
20
  error: Found argument 'unimplemented-command' which wasn't expected, or isn't valid in this context
  
  USAGE:
      rhg <SUBCOMMAND>
  
  For more information try --help
21
  [252]
22
23

Finding root
24
25
26
  $ rhg root
  abort: no repository found in '$TESTTMP' (.hg not found)!
  [255]
27

28
29
30
31
  $ hg init repository
  $ cd repository
  $ rhg root
  $TESTTMP/repository
32
33

Unwritable file descriptor
34
35
36
  $ rhg root > /dev/full
  abort: No space left on device (os error 28)
  [255]
37
38

Deleted repository
39
40
41
42
  $ rm -rf `pwd`
  $ rhg root
  abort: error getting current working directory: $ENOENT$
  [255]
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70

Listing tracked files
  $ cd $TESTTMP
  $ hg init repository
  $ cd repository
  $ for i in 1 2 3; do
  >   echo $i >> file$i
  >   hg add file$i
  > done
  > hg commit -m "commit $i" -q

Listing tracked files from root
  $ rhg files
  file1
  file2
  file3

Listing tracked files from subdirectory
  $ mkdir -p path/to/directory
  $ cd path/to/directory
  $ rhg files
  ../../../file1
  ../../../file2
  ../../../file3

Listing tracked files through broken pipe
  $ rhg files | head -n 1
  ../../../file1
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92

Debuging data in inline index
  $ cd $TESTTMP
  $ rm -rf repository
  $ hg init repository
  $ cd repository
  $ for i in 1 2 3; do
  >   echo $i >> file$i
  >   hg add file$i
  >   hg commit -m "commit $i" -q
  > done
  $ rhg debugdata -c 2
  e36fa63d37a576b27a69057598351db6ee5746bd
  test
  0 0
  file3
  
  commit 3 (no-eol)
  $ rhg debugdata -m 2
  file1\x00b8e02f6433738021a065f94175c7cd23db5f05be (esc)
  file2\x005d9299349fc01ddd25d0070d149b124d8f10411e (esc)
  file3\x002661d26c649684b482d10f91960cc3db683c38b4 (esc)
93

94
95
96
97
98
99
100
101
102
Debuging with full node id
  $ rhg debugdata -c `hg log -r 0 -T '{node}'`
  c8e64718e1ca0312eeee0f59d37f8dc612793856
  test
  0 0
  file1
  
  commit 1 (no-eol)

103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
Cat files
  $ cd $TESTTMP
  $ rm -rf repository
  $ hg init repository
  $ cd repository
  $ echo "original content" > original
  $ hg add original
  $ hg commit -m "add original" original
  $ rhg cat -r 0 original
  original content
Cat copied file should not display copy metadata
  $ hg copy original copy_of_original
  $ hg commit -m "add copy of original"
  $ rhg cat -r 1 copy_of_original
  original content
118
119
120
121
122
123
124
125
126

Requirements
  $ rhg debugrequirements
  dotencode
  fncache
  generaldelta
  revlogv1
  sparserevlog
  store
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142

  $ echo indoor-pool >> .hg/requires
  $ rhg files
  [252]

  $ rhg cat -r 1 copy_of_original
  [252]

  $ rhg debugrequirements
  dotencode
  fncache
  generaldelta
  revlogv1
  sparserevlog
  store
  indoor-pool
143
144
145
146
147

  $ echo -e '\xFF' >> .hg/requires
  $ rhg debugrequirements
  abort: .hg/requires is corrupted
  [255]