##// END OF EJS Templates
update: omit redundant activating message for already active bookmark...
update: omit redundant activating message for already active bookmark This patch also adds "hg bookmarks" invocation into tests, where redundant message is omitted but bookmark activity isn't clear from context.

File last commit:

r26950:6686ae52 default
r28500:2e1bceee default
Show More
test-tools.t
110 lines | 2.8 KiB | text/troff | Tads3Lexer
Mads Kiilerich
tests: add 'f' tool for cross platform file operations in the tests...
r23860 Tests of the file helper tool
$ f -h
Matt Mackall
test-tools: fix portability issues
r23909 ?sage: f [options] [filenames] (glob)
Mads Kiilerich
tests: add 'f' tool for cross platform file operations in the tests...
r23860
Matt Mackall
tests: more fixes for f
r23913 ?ptions: (glob)
Mads Kiilerich
tests: add 'f' tool for cross platform file operations in the tests...
r23860 -h, --help show this help message and exit
-t, --type show file type (file or directory)
-m, --mode show file mode
-l, --links show number of links
-s, --size show size of file
-n NEWER, --newer=NEWER
check if file is newer (or same)
-r, --recurse recurse into directories
-S, --sha1 show sha1 hash of the content
-M, --md5 show md5 hash of the content
-D, --dump dump file content
-H, --hexdump hexdump file content
-B BYTES, --bytes=BYTES
number of characters to dump
-L LINES, --lines=LINES
number of lines to dump
-q, --quiet no default output
$ mkdir dir
$ cd dir
$ f --size
size=0
$ echo hello | f --md5 --size
size=6, md5=b1946ac92492d2347c6235b4d2611184
$ f foo
foo: file not found
$ echo foo > foo
$ f foo
foo:
Matt Harbison
tests: conditionalize test-tools.t for Windows support...
r23867 #if symlink
Mads Kiilerich
tests: add 'f' tool for cross platform file operations in the tests...
r23860 $ f foo --mode
foo: mode=644
Matt Harbison
tests: conditionalize test-tools.t for Windows support...
r23867 #endif
Mads Kiilerich
tests: add 'f' tool for cross platform file operations in the tests...
r23860
Matt Harbison
tests: make 'f' tool open files in binary mode when hexdumping...
r26950 #if no-windows
Matt Harbison
tests: replace uses of 'seq' with portable 'seq.py'
r24361 $ python $TESTDIR/seq.py 10 > bar
Matt Harbison
tests: make 'f' tool open files in binary mode when hexdumping...
r26950 #else
Convert CRLF -> LF for consistency
$ python $TESTDIR/seq.py 10 | sed "s/$//" > bar
#endif
Matt Harbison
tests: conditionalize test-tools.t for Windows support...
r23867 #if unix-permissions symlink
Mads Kiilerich
tests: add 'f' tool for cross platform file operations in the tests...
r23860 $ chmod +x bar
$ f bar --newer foo --mode --type --size --dump --links --bytes 7
bar: file, size=21, mode=755, links=1, newer than foo
>>>
1
2
3
4
<<< no trailing newline
Matt Harbison
tests: conditionalize test-tools.t for Windows support...
r23867 #endif
Mads Kiilerich
tests: add 'f' tool for cross platform file operations in the tests...
r23860
Matt Mackall
test-tools: check for unix permissions for hardlinking
r23914 #if unix-permissions
Mads Kiilerich
tests: add 'f' tool for cross platform file operations in the tests...
r23860 $ ln bar baz
$ f bar -n baz -l --hexdump -t --sha1 --lines=9 -B 20
bar: file, links=2, newer than baz, sha1=612ca68d0305c821750a
0000: 31 0a 32 0a 33 0a 34 0a 35 0a 36 0a 37 0a 38 0a |1.2.3.4.5.6.7.8.|
0010: 39 0a |9.|
Matt Mackall
test-tools: another vfat fix
r23915 $ rm baz
Matt Mackall
test-tools: check for unix permissions for hardlinking
r23914 #endif
Mads Kiilerich
tests: add 'f' tool for cross platform file operations in the tests...
r23860
Matt Harbison
tests: conditionalize test-tools.t for Windows support...
r23867 #if unix-permissions symlink
Mads Kiilerich
tests: add 'f' tool for cross platform file operations in the tests...
r23860 $ ln -s yadda l
$ f . --recurse -MStmsB4
Matt Mackall
test-tools: another vfat fix
r23915 .: directory with 3 files, mode=755
Mads Kiilerich
tests: add 'f' tool for cross platform file operations in the tests...
r23860 ./bar: file, size=21, mode=755, md5=3b03, sha1=612c
./foo: file, size=4, mode=644, md5=d3b0, sha1=f1d2
Matt Mackall
tests: teach f not to report symlink mode bits...
r23912 ./l: link, size=5, md5=2faa, sha1=af93
Matt Harbison
tests: conditionalize test-tools.t for Windows support...
r23867 #endif
Mads Kiilerich
tests: add 'f' tool for cross platform file operations in the tests...
r23860
$ f --quiet bar -DL 3
1
2
3
$ cd ..
Matt Harbison
tests: conditionalize test-tools.t for Windows support...
r23867 Yadda is a symlink
#if symlink
Mads Kiilerich
tests: add 'f' tool for cross platform file operations in the tests...
r23860 $ f -qr dir -HB 17
Matt Mackall
test-tools: another vfat fix
r23915 dir: directory with 3 files
Mads Kiilerich
tests: add 'f' tool for cross platform file operations in the tests...
r23860 dir/bar:
0000: 31 0a 32 0a 33 0a 34 0a 35 0a 36 0a 37 0a 38 0a |1.2.3.4.5.6.7.8.|
0010: 39 |9|
dir/foo:
0000: 66 6f 6f 0a |foo.|
dir/l:
0000: 79 61 64 64 61 |yadda|
Matt Harbison
tests: conditionalize test-tools.t for Windows support...
r23867 #else
$ f -qr dir -HB 17
Matt Mackall
test-tools: portability tweak
r23957 dir: directory with 2 files (esc)
Matt Harbison
tests: conditionalize test-tools.t for Windows support...
r23867 dir/bar: (glob)
0000: 31 0a 32 0a 33 0a 34 0a 35 0a 36 0a 37 0a 38 0a |1.2.3.4.5.6.7.8.|
0010: 39 |9|
dir/foo: (glob)
0000: 66 6f 6f 0a |foo.|
#endif