Fossil SCM

fossil-scm / test / standin / transport.sh
Blame History Raw 21 lines
1
#!/bin/sh
2
# Stands in for a server. A test gives it to "fossil sync", "pull" or
3
# "push" as the --transport-command, and fossil calls it for each request:
4
#
5
# transport.sh URL REQUESTFILE REPLYFILE
6
#
7
# Request N is saved as request.N in the directory $TRANSPORT_DIR and
8
# answered with reply.N from there. Where the test wrote no reply.N, the
9
# answer is a bare timestamp, which ends the sync. Request 21 fails, so
10
# that a client that keeps asking is stopped.
11
count=$(cat "$TRANSPORT_DIR/count" 2>/dev/null || echo 0)
12
count=$((count + 1))
13
echo $count > "$TRANSPORT_DIR/count"
14
cp "$2" "$TRANSPORT_DIR/request.$count"
15
if test $count -gt 20; then exit 1; fi
16
if test -f "$TRANSPORT_DIR/reply.$count"; then
17
cp "$TRANSPORT_DIR/reply.$count" "$3"
18
else
19
printf '# timestamp %s errors 0\n' "$(date -u +%Y-%m-%dT%H:%M:%S)" > "$3"
20
fi
21

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button