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 (33 lines) | stat: -rw-r--r-- 992 bytes parent folder | download | duplicates (7)
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
-- note: do not compare to base_revision() here, because nothing says that
-- that can't be implemented using automate.
function extract_base_revision()
  local workrev = readfile("_MTN/revision")
  local extract = string.gsub(workrev, "^.*old_revision %[(%x*)%].*$", "%1")
  if extract == workrev then
    err("failed to extract base revision from _MTN/revision")
  end
  return extract
end

mtn_setup()

-- check an empty base revision id

check(mtn("automate", "get_base_revision_id"), 0, true, false)
check(trim(readfile("stdout")) == extract_base_revision())

addfile("foo", "this is file foo")

-- check a non-empty base reivision id

commit()

check(mtn("automate", "get_base_revision_id"), 0, true, false)
check(trim(readfile("stdout")) == extract_base_revision())

-- check that pending changes don't affect the base revision id

addfile("foo", "this is foo")

check(mtn("automate", "get_base_revision_id"), 0, true, false)
check(trim(readfile("stdout")) == extract_base_revision())