monotone-commits-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Monotone-commits-diffs] net.venge.monotone.issue-76: 3a61386f52e480fb4


From: code
Subject: [Monotone-commits-diffs] net.venge.monotone.issue-76: 3a61386f52e480fb4f4ed872c17c9d4e0460bef5
Date: Sun, 27 Mar 2011 13:10:18 +0200 (CEST)

revision:            3a61386f52e480fb4f4ed872c17c9d4e0460bef5
date:                2011-03-27T10:06:33
author:              Richard Hopkins <address@hidden>
branch:              net.venge.monotone.issue-76
changelog:
Created new revert_in_two_parent_workspace func test

Moved the existing revert test from two_parent_workspace_commands_that_fail
into it, and also copied the setup/writefile/commit template to produce a
workspace with 2 parents.

All the tests currently pass, however the new test is not yet finished so
I've left some TODO's in it for the meantime. The bottom section of
commented out code should be correct as it checks the workspace contents
after a revert to "right" - it just depends on the unimplemented revert to
"right" code.

Also, the code which checks the contents of the files should really be
"left\nancestor", but I couldn't get it to work by using \n in the string.
As a work around I check for both left + ancestor, and check for NOT right.

manifest:
format_version "1"

new_manifest [afaa5ff6add22181b114541b670bcefd8fa3d4f6]

old_revision [923c2015f49aa88f1533360cce4525e1dff7baf6]

add_dir "test/func/revert_in_two_parent_workspace"

add_file "test/func/revert_in_two_parent_workspace/__driver__.lua"
 content [d040c7e5badcbe9a246b3d1a64790f1c3c47b269]

patch "test/func/two_parent_workspace_commands_that_fail/__driver__.lua"
 from [11722f00bcdd5d2c2936972da66f0365afc7c889]
   to [62dc5459a99ca751ce021a47b7f3769b3f567b37]
============================================================
--- test/func/two_parent_workspace_commands_that_fail/__driver__.lua	11722f00bcdd5d2c2936972da66f0365afc7c889
+++ test/func/two_parent_workspace_commands_that_fail/__driver__.lua	62dc5459a99ca751ce021a47b7f3769b3f567b37
@@ -26,7 +26,6 @@ diag = "mtn: misuse: this command can on
 check(not qgrep("ancestor", "testfile"))
 
 diag = "mtn: misuse: this command can only be used in a single-parent workspace\n"
-revertdiag = "mtn: misuse: this workspace has multiple parents. specify which parent to use with -r\n"
 diffdiag = ("mtn: misuse: this workspace has more than one parent\n"..
         "mtn: misuse: (specify a revision to diff against with '--revision')\n")
 
@@ -51,9 +50,7 @@ check(mtn("automate", "get_file_of", "-r
 check(mtn("cat", "-r", left, "testfile"), 0, false, nil)
 check(mtn("automate", "get_file_of", "-r", right, "testfile"), 0, false, nil)
 
--- revert and update: to where?
-check(mtn("revert", "."), 1, nil, true)
-check(grep("-v", "detected at", "stderr"), 0, revertdiag)
+-- update: to where?
 check(mtn("update"), 1, nil, true)
 check(grep("-v", "detected at", "stderr"), 0, diag)
 
============================================================
--- /dev/null	
+++ test/func/revert_in_two_parent_workspace/__driver__.lua	d040c7e5badcbe9a246b3d1a64790f1c3c47b269
@@ -0,0 +1,65 @@
+-- create a workspace with 2 parents then revert to just one of them
+-- and check the workspace is consistent with it
+
+mtn_setup()
+
+addfile("testfile", "ancestor\nancestor")
+addfile("otherfile", "blah blah")
+commit()
+anc = base_revision()
+
+writefile("testfile", "left\nancestor")
+writefile("otherfile", "modified too")
+commit()
+left = base_revision()
+
+revert_to(anc)
+writefile("testfile", "ancestor\nright")
+commit()
+right = base_revision()
+
+check(mtn("merge_into_workspace", left), 0, false, false)
+check(qgrep("left", "testfile"))
+check(qgrep("right", "testfile"))
+check(not qgrep("ancestor", "testfile"))
+
+-- we now have workspace with 2 parents, so lets try a revert
+-- without specifying a revision - mtn should throw an error
+
+check(mtn("revert", "."), 1, nil, true)
+need_to_specify_diag = "mtn: misuse: this workspace has multiple parents. specify which parent to use with -r\n"
+check(grep("-v", "detected at", "stderr"), 0, need_to_specify_diag)
+
+-- now lets try a revert by specifying an invalid parent revision.
+-- the revision id MUST be valid - it just needs to NOT be a parent of the
+-- current workspace. if the revision id is not valid, mtn will throw an error
+-- about "no match for selection" - which we don't care about in this test
+
+check(mtn("revert", ".", "-r", anc), 1, nil, true)
+incorrect_parent_diag = "mtn: misuse: the specified revision is not a parent of the current workspace\n"
+check(grep("-v", "detected at", "stderr"), 0, incorrect_parent_diag)
+
+-- now lets revert back to a proper revision - and check the workspace
+-- contents
+check(mtn("revert", ".", "-r", left), 0, nil, true)
+-- TODO: don't know how to check for left\nancestor
+check(qgrep("left", "testfile"))
+check(qgrep("ancestor", "testfile"))
+check(not qgrep("right", "testfile"))
+
+check(qgrep("modified too", "otherfile"))
+
+-- TODO: file contents are fine - now lets check if the book keeping is
+-- correct by running "mtn status" and "mtn ls changed" - there should
+-- be no changes
+
+
+
+-- TODO: perform revert to right as well
+-- TODO: check for ancestor\nancestor
+--check(qgrep("ancestor", "testfile"))
+--check(not qgrep("left", "testfile"))
+--check(not qgrep("right", "testfile"))
+
+--check(qgrep("blah blah", "otherfile"))
+

reply via email to

[Prev in Thread] Current Thread [Next in Thread]