[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Monotone-commits-diffs] net.venge.monotone.not-selector: cbbe6a548dd5d5
From: |
code |
Subject: |
[Monotone-commits-diffs] net.venge.monotone.not-selector: cbbe6a548dd5d565dfd0601ba1df320a613d3dc6 |
Date: |
Mon, 13 Feb 2012 02:44:12 +0100 (CET) |
revision: cbbe6a548dd5d565dfd0601ba1df320a613d3dc6
date: 2012-02-13T01:41:58
author: Richard Hopkins <address@hidden>
branch: net.venge.monotone.not-selector
changelog:
Implement 'not' selector function and corresponding tests
Example:
Show all revisions which have not been tested yet
mtn log -r not(c:testresult)
manifest:
format_version "1"
new_manifest [eebb59809aef4d78f021d19ce8742d2b6d2563de]
old_revision [377d75d780a12a552941539f2e6a6e8d609fadb7]
patch "src/selectors.cc"
from [3efba0ce3139290b4088cea0d6e82a912565471e]
to [588c6b5fd3ded29f5f778a78e707352564acbc02]
patch "test/func/extended-selectors/__driver__.lua"
from [435f44fb1b33bdfb53929fe6bd15ba7fa4c2c1d3]
to [9d3932fa9405adc7b1d9117685f85e227515b052]
============================================================
--- src/selectors.cc 3efba0ce3139290b4088cea0d6e82a912565471e
+++ src/selectors.cc 588c6b5fd3ded29f5f778a78e707352564acbc02
@@ -523,6 +523,19 @@ public:
inserter(ret, ret.end()));
return ret;
}
+ else if (name == "not")
+ {
+ diagnose_wrong_arg_count("not", 1, args.size());
+ set<revision_id> lhs;
+ set<revision_id> rhs = args[0]->complete(project);
+
+ project.db.get_revision_ids(lhs);
+ set<revision_id> ret;
+ set_difference(lhs.begin(), lhs.end(),
+ rhs.begin(), rhs.end(),
+ inserter(ret, ret.end()));
+ return ret;
+ }
else if (name == "lca")
{
diagnose_wrong_arg_count("lca", 2, args.size());
============================================================
--- test/func/extended-selectors/__driver__.lua 435f44fb1b33bdfb53929fe6bd15ba7fa4c2c1d3
+++ test/func/extended-selectors/__driver__.lua 9d3932fa9405adc7b1d9117685f85e227515b052
@@ -1,5 +1,6 @@
-- selector functions are:
-- difference(a,b)
+-- not(a)
-- lca(a,b)
-- max(a)
-- ancestors(a)
@@ -78,6 +79,12 @@ expect("b:testbranch|b:otherbranch", roo
expect("b:testbranch/b:otherbranch", lhs)
expect("b:testbranch|b:otherbranch", root, lhs, rhs, m, other, other_2)
+expect("not(b:otherbranch)", root, rhs, m)
+expect("not(b:testbranch)", other, other_2)
+expect("not(h:testbranch)", root, lhs, rhs, other, other_2)
+expect("not(lca(h:testbranch;h:otherbranch))", root, rhs, m, other, other_2)
+expect("b:testbranch/not(a:Joe)", rhs, m)
+
expect("lca(h:testbranch;h:otherbranch)", lhs)
expect("max(b:testbranch/a:Joe)", lhs)
expect("max(b:otherbranch/a:Anne)")
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Monotone-commits-diffs] net.venge.monotone.not-selector: cbbe6a548dd5d565dfd0601ba1df320a613d3dc6,
code <=