monotone

monotone Mtn Source Tree

Root/tests/t_revert.at

1# -*- Autoconf -*-
2
3AT_SETUP([revert file to base version])
4
5MONOTONE_SETUP
6
7AT_DATA(testfile0, [version 0 of first test file
8])
9
10AT_CHECK(MONOTONE add testfile0, [], [ignore], [ignore])
11V1=`SHA1(testfile0)`
12AT_CHECK(MONOTONE --branch=testbranch commit 'blah blah', [], [ignore], [ignore])
13
14# check reverting a single file by name
15
16AT_DATA(testfile0, [squirrils monkeys dingos
17])
18
19AT_CHECK(grep squirrils testfile0, [0], [ignore])
20AT_CHECK(MONOTONE revert testfile0, [], [ignore], [ignore])
21AT_CHECK(grep squirrils testfile0, [1], [ignore])
22V2=`SHA1(testfile0)`
23AT_CHECK(test $V1 == $V2)
24
25
26# check reverting the whole tree
27
28AT_DATA(testfile0, [squirrils monkeys dingos
29])
30AT_CHECK(MONOTONE status, [], [stdout])
31AT_CHECK(grep testfile0 stdout, [0], [ignore])
32AT_CHECK(MONOTONE revert, [], [ignore], [ignore])
33AT_CHECK(test ! -e MT/work, [], [ignore])
34AT_CHECK(MONOTONE status, [], [stdout])
35AT_CHECK(grep testfile0 stdout, [1], [ignore])
36
37
38# check reverting a delete
39
40AT_CHECK(MONOTONE drop testfile0, [0], [ignore], [ignore])
41AT_CHECK(grep testfile0 MT/work, [0], [ignore])
42AT_CHECK(MONOTONE status, [], [stdout])
43AT_CHECK(grep testfile0 stdout, [0], [ignore])
44AT_CHECK(MONOTONE revert, [], [ignore], [ignore])
45AT_CHECK(test ! -e MT/work, [], [ignore])
46AT_CHECK(MONOTONE status, [], [stdout])
47AT_CHECK(grep testfile0 stdout, [1], [ignore])
48
49
50# check reverting a change and a delete
51
52AT_CHECK(echo 'liver and maude' >> testfile0, [], [ignore])
53AT_CHECK(MONOTONE drop testfile0, [0], [ignore], [ignore])
54AT_CHECK(grep testfile0 MT/work, [0], [ignore])
55AT_CHECK(MONOTONE status, [], [stdout])
56AT_CHECK(grep testfile0 stdout, [0], [ignore])
57AT_CHECK(MONOTONE revert testfile0, [], [ignore], [ignore])
58AT_CHECK(test ! -e MT/work, [], [ignore])
59AT_CHECK(MONOTONE status, [], [stdout])
60AT_CHECK(grep testfile0 stdout, [1], [ignore])
61V3=`SHA1(testfile0)`
62AT_CHECK(test $V1 == $V3)
63
64# check reverting an add
65
66AT_DATA(testfile1, [squirrils monkeys dingos
67])
68AT_CHECK(MONOTONE add testfile1, [0], [ignore], [ignore])
69AT_CHECK(grep testfile1 MT/work, [0], [ignore])
70AT_CHECK(MONOTONE status, [], [stdout])
71AT_CHECK(grep testfile1 stdout, [0], [ignore])
72AT_CHECK(MONOTONE revert, [], [ignore], [ignore])
73AT_CHECK(test ! -e MT/work, [], [ignore])
74AT_CHECK(MONOTONE status, [], [stdout])
75AT_CHECK(grep testfile1 stdout, [1], [ignore])
76
77# check reverting a directory
78
79AT_CHECK(mkdir sub, [], [ignore])
80AT_DATA(sub/testfile2, [maude
81])
82AT_CHECK(MONOTONE add sub/testfile2, [], [ignore], [ignore])
83AT_CHECK(MONOTONE commit 'new file', [], [ignore], [ignore])
84AT_DATA(sub/testfile2, [liver
85])
86AT_CHECK(MONOTONE status, [], [stdout])
87AT_CHECK(grep sub stdout, [], [ignore])
88AT_CHECK(MONOTONE revert sub, [], [ignore], [ignore])
89AT_CHECK(MONOTONE status, [], [stdout])
90AT_CHECK(grep sub stdout, [1], [ignore])
91
92# it also shouldn't matter how we spell the subdirectory name
93AT_DATA(sub/testfile2, [liver
94])
95AT_CHECK(MONOTONE status, [], [stdout])
96AT_CHECK(grep sub stdout, [], [ignore])
97AT_CHECK(MONOTONE revert sub/, [], [ignore], [ignore])
98AT_CHECK(MONOTONE status, [], [stdout])
99AT_CHECK(grep sub stdout, [1], [ignore])
100
101
102AT_CLEANUP

Archive Download this file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status