File: test-fix-path.t

package info (click to toggle)
mercurial 7.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 44,824 kB
  • sloc: python: 206,444; ansic: 56,415; tcl: 3,715; sh: 1,797; lisp: 1,483; cpp: 864; makefile: 752; javascript: 649; xml: 36
file content (67 lines) | stat: -rw-r--r-- 1,488 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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

A script that implements uppercasing of specific lines in a file. This
approximates the behavior of code formatters well enough for our tests.

  $ hg init test-repo
  $ cd test-repo

  $ mkdir some
  $ mkdir some/dir
  $ cat > some/dir/uppercase.py <<EOF
  > #!$PYTHON
  > import re
  > import sys
  > from mercurial.utils import procutil
  > procutil.setbinary(sys.stdin)
  > procutil.setbinary(sys.stdout)
  > stdin = getattr(sys.stdin, 'buffer', sys.stdin)
  > stdout = getattr(sys.stdout, 'buffer', sys.stdout)
  > def format(text):
  >   return re.sub(b' +', b' ', text.upper())
  > stdout.write(format(stdin.read()))
  > EOF

  $ chmod +x some/dir/uppercase.py

#if windows
  $ cat > some/dir/uppercase.bat <<EOF
  > @echo off
  > "$PYTHON" "$TESTTMP/test-repo/some/dir/uppercase.py"
  > EOF
#else
  $ mv some/dir/uppercase.py some/dir/uppercase
#endif

  $ echo babar > babar.txt
  $ hg add babar.txt

Using absolute paths

  $ cat >> $HGRCPATH <<EOF
  > [extensions]
  > fix =
  > [experimental]
  > evolution.createmarkers=True
  > evolution.allowunstable=True
  > [fix]
  > extra-bin-paths=$TESTTMP/test-repo/some/dir/
  > uppercase-whole-file:command=uppercase
  > uppercase-whole-file:pattern=set:**.txt
  > EOF

  $ hg fix --working-dir
  $ cat babar.txt
  BABAR

Using relative paths

  $ cat >> $HGRCPATH <<EOF
  > [fix]
  > extra-bin-paths=./some/dir/
  > EOF

  $ echo celeste > celeste.txt
  $ hg add celeste.txt
  $ hg fix --working-dir
  $ cat celeste.txt
  CELESTE