File: 008_update_to_rev

package info (click to toggle)
fsvs 1.2.7-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 2,964 kB
  • ctags: 1,464
  • sloc: ansic: 16,650; sh: 5,885; perl: 783; makefile: 338; python: 90
file content (124 lines) | stat: -rwxr-xr-x 2,446 bytes parent folder | download | duplicates (4)
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
113
114
115
116
117
118
119
120
121
122
123
124
#!/bin/bash

set -e 
$PREPARE_CLEAN > /dev/null
$INCLUDE_FUNCS
cd $WC

logfile=$LOGDIR/008.log

filename=update-file.upd
dir=2313
file2=$dir/garble

function VL
{
  if [[ "$VERBOSE" != "" ]]
	then
		# If the files don't exist, we'd stop because 
		# ls doesn't find the given name.
		# This way the output is shorter - only 2 lines compared to 10.
	  ls -la --full-time $WC/* $WC2/* || true
	fi
}

if [[ -e $filename ]]
then
  rm $filename
	$BINq ci -m "delete the test-file"
fi

# this next line has two tabulators - in grep and cut
rev=`$BINdflt up | grep "revision	" | tail -1 | cut -f2 -d"	" | cut -f1 -d"."` 

echo "now at rev. $rev"

echo "A testline #1" > $filename
echo "A testline #2" >> $filename
# We do a directory with an entry here, to see
# whether directories only available in the repository
# are correctly handled.
mkdir $dir
echo $file2 > $file2

echo "     ci1"
VL
$BINq ci -m "new file"

echo "A further line" >> $filename
echo $file2 >> $file2
echo "     ci2"
VL
$BINq ci -m "new file"

VL
$BINq up -r$rev
VL
if [[ -e $filename ]]
then
  $ERROR 'File should not exist!'
else
  $SUCCESS 'Ok, file was deleted'
fi

if [[ `$BINdflt remote-status | grep $filename` == "N... "* ]]
then
  $SUCCESS "remote-status says to-be-done (1)."
else
	$ERROR " remote-status failed (1)!"
fi

$BINq up -r`expr $rev + 1`
VL
if [[ `wc -l < $filename` -ne 2 ]]
then
  $ERROR 'File has wrong data!'
else
  $SUCCESS 'Ok, file was added'
fi

if [[ `$BINdflt remote-status | grep $filename` == .?C?" "* ]]
then
  $SUCCESS " remote-status says to-be-done (2)."
else
	$ERROR " remote-status failed (2)!"
fi

$BINq up -r`expr $rev + 2`
VL
if [[ `wc -l < $filename` -ne 3 ]]
then
  $ERROR 'File has wrong data!'
else
  $SUCCESS 'file was modified'
fi

if [[ `$BINdflt remote-status -r$rev | grep $filename` == "D..."* ]]
then
  $SUCCESS " remote-status to old revision says to-be-deleted."
else
	$ERROR " remote-status -r $rev failed (3)!"
fi

$BINdflt remote-status > $logfile
if grep $filename < $logfile
then
	cat $logfile
	$ERROR " remote-status failed (4)!"
else
  $SUCCESS " remote-status says nothing."
fi

touch -t 200406271837 $filename
$BINdflt remote-status > $logfile
if grep $filename < $logfile
then
	$ERROR " remote-status failed (5)!"
else
  $SUCCESS " remote-status on touched file says nothing."
fi
VL

# No $WC2_UP_ST_COMPARE here, as the file was touched.
# We'd have to update to an earlier version, and return to the present :-)