File: __driver__.lua

package info (click to toggle)
monotone 1.1-9
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 20,984 kB
  • ctags: 8,622
  • sloc: cpp: 86,450; sh: 6,906; perl: 924; makefile: 813; python: 517; lisp: 379; sql: 118; exp: 91; ansic: 52
file content (49 lines) | stat: -rw-r--r-- 1,394 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

includecommon("netsync.lua")
mtn_setup()
netsync.setup()

addfile("testfile", "1")
commit("branch1")
B1=base_revision()

writefile("testfile", "2")
commit("branch2")
B2=base_revision()

addfile("testfile", "3")
commit("branch3")
B3=base_revision()

writefile("testfile", "4")
commit("branch4")
B4=base_revision()

-- Serve excluding branch2, branch4
-- attempting to pull them should fail
-- pulling everything but them should give revs B1, B2, B3; and only
-- give branch certs on B1, B3.
get("read-permissions")

srv = netsync.start()

-- it is apparently a permissions error to pull a branch that is not served
-- i.e. 'received network error: access to branch 'branch2' denied by server'

srv:pull("branch2", nil, 1)
srv:pull("branch4", nil, 1)
check(mtn2("automate", "get_revision", B1), 1, false, false)
check(mtn2("automate", "get_revision", B2), 1, false, false)
check(mtn2("automate", "get_revision", B3), 1, false, false)
check(mtn2("automate", "get_revision", B4), 1, false, false)

srv:pull({'branch*', "--exclude=branch2", "--exclude=branch4"})
check(mtn2("automate", "get_revision", B1), 0, false, false)
check(mtn2("automate", "get_revision", B2), 0, false, false)
check(mtn2("automate", "get_revision", B3), 0, false, false)
check(mtn2("automate", "get_revision", B4), 1, false, false)

check(mtn2("ls", "certs", B2), 0, true)
check(not qgrep("branch2", "stdout"))

srv:stop()