Re: New branch name with no other changes

Stephen Leake <[email protected]>
Newsgroups gmane.comp.version-control.monotone.devel
Message-ID <[email protected]>
Quoting Hendrik Boom <[email protected]>:

> 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.