monotone-devel
[Top][All Lists]
Advanced

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

Re: [Monotone-devel] new branch expansion hook


From: William Uther
Subject: Re: [Monotone-devel] new branch expansion hook
Date: Thu, 6 Sep 2007 08:30:15 +1000


On 05/09/2007, at 9:14 PM, Nathaniel Smith wrote:

Re: suspend certs, does leaving out suspended branches mean that it is
impossible to name those branches, even explicitly?  Taking branches
out of the 'ls branches' clutter is one thing, making it impossible to
check them out by name at all seems problematic...

I put specific code in 'update' to handle this. I didn't put specific code in checkout.

Something like this might work:

#
# old_revision [d59175a822bc31fbe5ed88b9cb9db6b1c2d49bca]
#
# patch "cmd_ws_commit.cc"
#  from [c526804d60744f302780eaf3fd89663836591710]
#    to [bc426df46cd30cfb8c7c0bce57d9c228312e9f4a]
#
============================================================
--- cmd_ws_commit.cc    c526804d60744f302780eaf3fd89663836591710
+++ cmd_ws_commit.cc    bc426df46cd30cfb8c7c0bce57d9c228312e9f4a
@@ -539,7 +539,17 @@ CMD(checkout, "checkout", "co", CMD_REF(
       set<revision_id> heads;
       app.get_project().get_branch_heads(app.opts.branchname, heads);
-      N(heads.size() > 0,
+      if (heads.empty())
+        {
+          // try ignoring suspend certs and see if we get something
+          bool ignore_suspend_certs = app.opts.ignore_suspend_certs;
+          app.opts.ignore_suspend_certs = true;
+ app.get_project().get_branch_heads(app.opts.branchname, heads);
+          app.opts.ignore_suspend_certs = ignore_suspend_certs;
+          if (!heads.empty())
+ P(F("Branch '%s' suspended : checking out regardless") % app.opts.branchname);
+        }
+      N(!heads.empty(),
         F("branch '%s' is empty") % app.opts.branchname);
       if (heads.size() > 1)
         {

Are there other commands you'd put this type of code into? (And note that it doesn't do entirely what you want. e.g. If you put that code in and then try to check out the net.venge.monotone.suspend-cert branch, you'll find there are multiple heads, all suspended. I suspect this might end up being quite common if you use suspend to suspend micro-branches.)

The other option would be to stick something in options_list.hh so that every time you specify -b it checks to see if the branch is empty. If it is, then it checks if it is empty when ignoring suspend certs. If that returns something then automagically add the ignore_suspend_certs flag.

That seems like a rather, er, "brave" option though.

Cheers,

Will       :-}





reply via email to

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