File: filepath.sh

package info (click to toggle)
darcs 2.18.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,960 kB
  • sloc: haskell: 47,748; sh: 13,466; ansic: 447; perl: 134; makefile: 8
file content (112 lines) | stat: -rw-r--r-- 2,809 bytes parent folder | download
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/usr/bin/env bash

# Some tests for proper handling of filepaths

. lib

DIR=`pwd`

rm -rf temp1 temp2

# Make sure that init works with --repodir
darcs init --repodir=temp1
test -d temp1/_darcs

# add some meat to that repository
cd temp1
touch baz
darcs add baz
darcs record -m moo -a
cd ..

# ----------------------------------------------------------------------
# local vs remote filepaths
# ----------------------------------------------------------------------

# Windows does not allow ':' in file names
if ! os_is_windows; then
  darcs get temp1 temp2
  cd temp2
  mkdir -p dir
  darcs add dir
  cd dir
  touch foo:bar
  darcs add --reserved-ok foo:bar
  cd ../..
  rm -rf temp2
fi

# ----------------------------------------------------------------------
# repodir stuff
# ----------------------------------------------------------------------
mkdir -p temp1/non-darcs
# FIXME: This test does not seem to make much sense
# --repodir is not recursive
not darcs get temp1/non-darcs 2> log
grep "Not a repository" log
rm -rf temp1/non-darcs
rm -rf non-darcs

# get accepts --repodir.
darcs get --repodir=temp2 temp1 | grep -i "Finished cloning"
test -d temp2/_darcs
rm -rf temp2
# get accepts absolute --repodir.
darcs get --repodir="${DIR}/temp2" temp1 | grep -i "Finished cloning"
test -d temp2/_darcs

# changes accepts --repodir.
darcs changes --repodir=temp1 | grep -i "moo"
# changes accepts absolute --repo.
darcs changes --repo="${DIR}/temp1" | grep -i "moo"
# changes accepts relative --repo.
darcs changes --repo=temp1 | grep -i "moo"
# [issue467] context --repodir
darcs changes --context --repodir=temp1 | grep 'Context:'

# dist accepts --repodir.
darcs dist --repodir=temp1 | grep -i "Created dist"

# optimize accepts --repodir.
darcs optimize reorder --repodir=temp1 | grep -i "done"

# repair accepts --repodir.
darcs repair --repodir=temp1 | grep -i "already consistent"

# replace accepts --repodir.
darcs replace --repodir=temp1 foo bar baz

# setpref accepts --repodir.
darcs setpref --repodir=temp1 test echo | grep -i "Changing value of test"

# test --linear accepts --repodir.
darcs test --linear --repodir=temp1 | grep -i "Test does not fail on head"

# ----------------------------------------------------------------------
# converting between absolute and relative paths
# ----------------------------------------------------------------------

rm -rf temp3
darcs get temp1 temp3
cd temp3
mkdir -p a/b
cd ..

cd temp2
echo hello 1 >> baz
darcs record -m hello1 -a
echo hello 2 >> baz
darcs record -m hello2 -a
cd ..

# can handle .. path
cd temp3
darcs pull ../temp2 --set-default -p1 --all | grep -i 'Finished pulling'
darcs pull --dry-run | grep hello2
cd a/b
#[issue268] repodir with subdir
darcs pull --dry-run | grep hello2
cd ..
cd ..

rm -rf log temp1 temp2 temp3