monotone-devel
[Top][All Lists]
Advanced

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

Re: [Monotone-devel] New branch name with no other changes


From: Stephen Leake
Subject: Re: [Monotone-devel] New branch name with no other changes
Date: Fri, 10 Jun 2011 07:03:55 -0700
User-agent: Internet Messaging Program (IMP) H3 (4.3.9)

Quoting Hendrik Boom <address@hidden>:

On Thu, Jun 09, 2011 at 02:14:16PM -0400, Hendrik Boom wrote,

but forgot to mention he was using mtn 1.0:

I checked out a new workspace, and I want to check it in again unchenged
with a new branch name  -- the one I want to use to make changes.  I'd
like to make it clear that the new branch is starting in the same state
as the current head in the old one.

I use this:

function gds_create_mission(mission, from_branch, new_branch)
   local from_project, new_project, result, output, rev

   from_project = mission .. "." .. from_branch
   new_project = mission .. "." .. new_branch

   io.write("checking ...\n")
   result, output = mtn_automate("branches")
   if not result then
      error(string.format("Error from 'mtn_automate branches %s'", output))
   end

   if string.find (output, new_project) then
      error(string.format("%s branch already declared", new_project))
   end

   result, output = mtn_automate("heads", from_project)
   if not result then
      error(string.format("Error from 'mtn_automate heads %s'", from_project))
   end

-- A single head gives an output with a single 40 byte rev id, plus newline.
   if #output > 41 then
      error(string.format("%s has multiple heads; need merge", from_project))
   end

   io.write(string.format("creating %s from %s\n", new_project, from_project))
   result, output = mtn_automate("select", "h:" .. from_project)
   if not result then
error(string.format("Error from 'mtn_automate select %s'", "h:" .. from_project))
   end
   rev = string.sub(output, 1, 40)
   result, output = mtn_automate("cert", rev, "branch", new_project)
   if not result then
error(string.format("Error from 'mtn_automate cert %s branch %s : %s'", rev, new_project, output))
   end
end

register_command("gds_create_mission", "mission from_branch new_branch", "create mtn branch for a GDS mission",
      "Create mtn branch derived from FROM_BRANCH, in MISSION.",
      "gds_create_mission")

The key command is "automate cert"; just add the new branch cert to the existing revision.

There have been discussions before about making something like this part of mtn, but nothing has been agreed on.


-- Stephe




reply via email to

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