#
# patch "ChangeLog"
# from [96b212e1483a8f673f6a6698f1a4d27dd940ba07]
# to [4fe69309afd9fd8f182668e464125d7799ad3b48]
#
# patch "database.cc"
# from [7700f558782068baadcacb73f7623ad2b7933456]
# to [f1ef5e0001981e0000a66760a84f04d9a9bc1f81]
#
# patch "monotone.texi"
# from [85b132611b62bec54be47190f07d3d0402ca31ed]
# to [2d8ae6844b99622c75adfcb0ed55e56bdeecd359]
#
========================================================================
--- ChangeLog 96b212e1483a8f673f6a6698f1a4d27dd940ba07
+++ ChangeLog 4fe69309afd9fd8f182668e464125d7799ad3b48
@@ -1,3 +1,9 @@
+2005-10-14 Emile Snyder
+
+ * database.cc (complete): enhance h: and b: to mean "current
+ branch" (as defined by your working copy) when given empty.
+ * monotone.texi: document it.
+
2005-10-13 Emile Snyder
* commands.cc (CMD(revert)): use --missing for revert a'la drop.
========================================================================
--- database.cc 7700f558782068baadcacb73f7623ad2b7933456
+++ database.cc f1ef5e0001981e0000a66760a84f04d9a9bc1f81
@@ -2123,18 +2123,26 @@
else if (i->first == selectors::sel_head)
{
// get branch names
- string subquery = (boost::format("SELECT DISTINCT value FROM revision_certs WHERE name='%s' and unbase64(value) glob '%s'")
- % branch_cert_name % i->second).str();
vector branch_names;
- results res;
- fetch(res, one_col, any_rows, subquery.c_str());
- for (size_t i = 0; i < res.size(); ++i)
+ if (i->second.size() == 0)
{
- base64 row_encoded(res[i][0]);
- data row_decoded;
- decode_base64(row_encoded, row_decoded);
- branch_names.push_back(row_decoded());
+ __app->require_working_copy("the empty head selector h: refers to the head of the current branch");
+ branch_names.push_back((__app->branch_name)());
}
+ else
+ {
+ string subquery = (boost::format("SELECT DISTINCT value FROM revision_certs WHERE name='%s' and unbase64(value) glob '%s'")
+ % branch_cert_name % i->second).str();
+ results res;
+ fetch(res, one_col, any_rows, subquery.c_str());
+ for (size_t i = 0; i < res.size(); ++i)
+ {
+ base64 row_encoded(res[i][0]);
+ data row_decoded;
+ decode_base64(row_encoded, row_decoded);
+ branch_names.push_back(row_decoded());
+ }
+ }
// for each branch name, get the branch heads
set heads;
@@ -2166,20 +2174,32 @@
string prefix;
string suffix;
selector_to_certname(i->first, certname, prefix, suffix);
- lim += (boost::format("SELECT id FROM revision_certs WHERE name='%s' AND ") % certname).str();
- switch (i->first)
+ L(F("processing selector type %d with i->second '%s'\n") % ty % i->second);
+ if ((i->first == selectors::sel_branch) && (i->second.size() == 0))
{
- case selectors::sel_earlier:
- lim += (boost::format("unbase64(value) <= X'%s'") % encode_hexenc(i->second)).str();
- break;
- case selectors::sel_later:
- lim += (boost::format("unbase64(value) > X'%s'") % encode_hexenc(i->second)).str();
- break;
- default:
- lim += (boost::format("unbase64(value) glob '%s%s%s'")
- % prefix % i->second % suffix).str();
- break;
+ __app->require_working_copy("the empty branch selector b: refers to the current branch");
+ // FIXME: why do we have to glob on the unbase64(value), rather than being able to use == ?
+ lim += (boost::format("SELECT id FROM revision_certs WHERE name='%s' AND unbase64(value) glob '%s'")
+ % branch_cert_name % __app->branch_name).str();
+ L(F("limiting to current branch '%s'\n") % __app->branch_name);
}
+ else
+ {
+ lim += (boost::format("SELECT id FROM revision_certs WHERE name='%s' AND ") % certname).str();
+ switch (i->first)
+ {
+ case selectors::sel_earlier:
+ lim += (boost::format("unbase64(value) <= X'%s'") % encode_hexenc(i->second)).str();
+ break;
+ case selectors::sel_later:
+ lim += (boost::format("unbase64(value) > X'%s'") % encode_hexenc(i->second)).str();
+ break;
+ default:
+ lim += (boost::format("unbase64(value) glob '%s%s%s'")
+ % prefix % i->second % suffix).str();
+ break;
+ }
+ }
}
//L(F("found selector type %d, selecting_head is now %d\n") % i->first % selecting_head);
}
========================================================================
--- monotone.texi 85b132611b62bec54be47190f07d3d0402ca31ed
+++ monotone.texi 2d8ae6844b99622c75adfcb0ed55e56bdeecd359
@@ -2329,12 +2329,16 @@
@item Branch selection
Uses selector type @code{b}. For example, @code{b:net.venge.monotone} matches
@code{branch} certs where the cert value is @code{net.venge.monotone}.
-Values to match for can have shell wildcards.
+Values to match for can have shell wildcards. If you give a bare @code{b:}
+monotone will require you to be in a working copy, and will use the branch
+value recorded in your MT/options file.
@item Heads selection
Uses selector type @code{h}. For example, @code{h:net.venge.monotone} matches
@code{branch} certs where the cert value is @code{net.venge.monotone} and
the associated revision is a head revision on that branch. Values to match
-for can have shell wildcards like the branch selector.
+for can have shell wildcards like the branch selector. If you give a bare
address@hidden:} monotone will require you to be in a working copy, and use the branch
+recorded in your MT/options file.
@item Date selection
Uses selector type @code{d}. For example, @code{d:2004-04} matches
@code{date} certs where the cert value begins with