OpenPKG CVS Repository
  http://cvs.openpkg.org/
  ____________________________________________________________________________

  Server: cvs.openpkg.org                  Name:   Ralf S. Engelschall
  Root:   /v/openpkg/cvs                   Email:  r...@openpkg.org
  Module: openpkg-src                      Date:   24-Jul-2009 23:24:15
  Branch: HEAD                             Handle: 2009072422241500

  Modified files:
    openpkg-src/monotone    monotone.patch.rse monotone.spec

  Log:
    improve 'base' command

  Summary:
    Revision    Changes     Path
    1.16        +84 -30     openpkg-src/monotone/monotone.patch.rse
    1.46        +1  -1      openpkg-src/monotone/monotone.spec
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: openpkg-src/monotone/monotone.patch.rse
  ============================================================================
  $ cvs diff -u -r1.15 -r1.16 monotone.patch.rse
  --- openpkg-src/monotone/monotone.patch.rse   13 May 2009 10:29:35 -0000      
1.15
  +++ openpkg-src/monotone/monotone.patch.rse   24 Jul 2009 21:24:15 -0000      
1.16
  @@ -713,7 +713,7 @@
   ===================================================================
   Index: std_hooks.lua
   --- std_hooks.lua    eff8bcbd98c0643e183c5a1ee043a2af914129ac
  -+++ std_hooks.lua    2d0196520ddca56c6cbd943060665e74900e3153
  ++++ std_hooks.lua    1993689109813e2b55ee06e825e2652b129115e9
   @@ -304,6 +304,15 @@ function edit_comment(basetext, user_log
       if user_log_message == "" or string.sub(user_log_message, -1) ~= "\n" 
then
          tmp:write("\n")
  @@ -730,7 +730,7 @@
       tmp:write(basetext)
       io.close(tmp)
    
  -@@ -1375,3 +1384,213 @@ end
  +@@ -1375,3 +1384,267 @@ end
          return push_hook_functions(notifier)
       end
    end
  @@ -820,28 +820,39 @@
   +    end
   +end
   +
  -+--  extra command: "mtn base {upgrade|diff}"
  ++--  extra command: "mtn base {upgrade|diff|integrate}"
   +register_command(
  -+    "base", "upgrade|diff [FILENAME]",
  -+    "Upgrades or compares current branch against base branch",
  -+    "Upgrade current branch from base branch or compares current " ..
  -+    "branch against base branch. The base branch has to be stored " ..
  -+    "either in the \"mtn:base\" attribute of the root directory " ..
  -+    "or in a \".mtn-base\" file in the root directory.",
  ++    "base", "fork|upgrade|diff|integrate [BRANCHNAME|FILENAME]",
  ++    "Forks, upgrades, compares or integrates current branch 
from/against/into base branch",
  ++    "Forks a new branch from the current branch, " ..
  ++    "upgrade current branch from base branch, " ..
  ++    "or compares current branch against base branch, " ..
  ++    "or integrates current branch into base branch. " ..
  ++    "The base branch has to be stored either in the " ..
  ++    "\"mtn:base\" attribute of the root directory or in a \".mtn-base\" " ..
  ++    "file in the root directory.",
   +    "command_base"
   +)
  -+function command_base(op, filename)
  ++function command_base(op, arg)
   +    --  sanity check command line
   +    if op == nil then
   +        io.stderr:write("mtn: base: ERROR: no operation specified\n")
   +        return
   +    end
  -+    if op ~= "upgrade" and op ~= "diff" then
  -+        io.stderr:write("mtn: base: ERROR: either \"upgrade\" or \"diff\" 
operation has to be specified\n")
  ++    if op ~= "fork" and op ~= "upgrade" and op ~= "diff" and op ~= 
"integrate" then
  ++        io.stderr:write("mtn: base: ERROR: either \"fork\", \"upgrade\", or 
\"diff\" or \"integrate\" operation has to be specified\n")
   +        return
   +    end
  -+    if op == "upgrade" and filename ~= nil then
  -+        io.stderr:write("mtn: base: ERROR: filename constraint valid for 
\"diff\" operation only\n")
  ++    if op == "fork" and arg == nil then
  ++        io.stderr:write("mtn: base: ERROR: BRANCHNAME argument missing for 
\"fork\" operation\n")
  ++        return
  ++    end
  ++    if op == "upgrade" and arg ~= nil then
  ++        io.stderr:write("mtn: base: ERROR: argument not valid for 
\"upgrade\" operation\n")
  ++        return
  ++    end
  ++    if op == "integrate" and arg ~= nil then
  ++        io.stderr:write("mtn: base: ERROR: argument not valid for 
\"integrate\" operation\n")
   +        return
   +    end
   +
  @@ -858,24 +869,47 @@
   +
   +    --  determine base branch of workspace
   +    local branch_base = nil
  -+    local rc, txt = mtn_automate("get_attributes", ".")
  -+    if txt ~= nil then
  -+        branch_base = string.match(txt, 
"attr%s+\"mtn:base\"%s+\"([^\"]+)\"")
  -+    end
  -+    if branch_base == nil then
  -+        local txt = read_contents_of_file(".mtn-base", "r")
  ++    if op == "upgrade" or op == "diff" or op == "integrate" then
  ++        local rc, txt = mtn_automate("get_attributes", ".")
   +        if txt ~= nil then
  -+            branch_base = string.match(txt, "^%s*(%S+)%s*$")
  ++            branch_base = string.match(txt, 
"attr%s+\"mtn:base\"%s+\"([^\"]+)\"")
  ++        end
  ++        if branch_base == nil then
  ++            local txt = read_contents_of_file(".mtn-base", "r")
  ++            if txt ~= nil then
  ++                branch_base = string.match(txt, "^%s*(%S+)%s*$")
  ++            end
  ++        end
  ++        if branch_base == nil then
  ++            io.stderr:write("mtn: base: ERROR: failed to determine base 
branch\n")
  ++            return
   +        end
  -+    end
  -+    if branch_base == nil then
  -+        io.stderr:write("mtn: base: ERROR: failed to determine base 
branch\n")
  -+        return
   +    end
   +
   +    --  dispatch according to operation
  -+    if op == "upgrade" then
  ++    if op == "fork" then
  ++        --  fork new branch from current branch
  ++        io.stderr:write("mtn: base: fork current branch \"" .. branch_this 
.. "\" into new branch \"" .. arg .. "\"\n")
  ++        fh = io.open(".mtn-base", "w")
  ++        fh:write(branch_this)
  ++        io.close(fh)
  ++        local rc, txt = mtn_automate("get_attributes", ".mtn-base")
  ++        if rc ~= 0 then
  ++            --  .mtn-base still not existing in current branch
  ++            local rc = execute("mtn", "add", ".mtn-base")
  ++            if rc ~= 0 then
  ++                io.stderr:write("mtn: base: ERROR: failed to execute \"mtn 
add\"\n")
  ++                return
  ++            end
  ++        end
  ++        rc = execute("mtn", "commit", "-m", "[auto-commit] add hint-file 
\".mtn-base\" to branch \"" .. arg .. "\"", "-b", arg, ".mtn-base")
  ++        if rc ~= 0 then
  ++            io.stderr:write("mtn: base: ERROR: failed to execute \"mtn 
commit\"\n")
  ++            return
  ++        end
  ++    elseif op == "upgrade" then
   +        --  upgrade current branch by merging in revisions of base branch
  ++        io.stderr:write("mtn: base: upgrade current branch \"" .. 
branch_this .. "\" from base branch \"" .. branch_base .. "\"\n")
   +        local rc = execute("mtn", "propagate", branch_base, branch_this)
   +        if rc ~= 0 then
   +            io.stderr:write("mtn: base: ERROR: failed to execute \"mtn 
propagate\"\n")
  @@ -888,12 +922,13 @@
   +        end
   +    elseif op == "diff" then
   +        --  upgrade current branch by merging in revisions of base branch
  ++        io.stderr:write("mtn: base: diff current branch \"" .. branch_this 
.. "\" against base branch \"" .. branch_base .. "\"\n")
   +        local rc
  -+        if filename ~= nil then
  -+            if not string.sub(filename, 1, 1) ~= "/" then
  -+                filename = workspace_relpath() .. "/" .. filename
  ++        if arg ~= nil then
  ++            if not string.sub(arg, 1, 1) ~= "/" then
  ++                arg = workspace_relpath() .. "/" .. arg
   +            end
  -+            rc = execute("mtn", "diff", "-r", "h:" .. branch_base, "-r", 
"h:" .. branch_this, filename)
  ++            rc = execute("mtn", "diff", "-r", "h:" .. branch_base, "-r", 
"h:" .. branch_this, arg)
   +        else
   +            rc = execute("mtn", "diff", "-r", "h:" .. branch_base, "-r", 
"h:" .. branch_this)
   +        end
  @@ -901,6 +936,25 @@
   +            io.stderr:write("mtn: base: ERROR: failed to execute \"mtn 
diff\"\n")
   +            return
   +        end
  ++    elseif op == "integrate" then
  ++        --  integrate back current branch by merging its revision into the 
base branch
  ++        io.stderr:write("mtn: base: integrate current branch \"" .. 
branch_this .. "\" into base branch \"" .. branch_base .. "\"\n")
  ++        rc = execute("mtn", "rm", ".mtn-base")
  ++        rc = execute("mtn", "commit", "-m", "[auto-commit] remove hint-file 
\".mtn-base\" from branch \"" .. branch_this .. "\"", ".mtn-base")
  ++        if rc ~= 0 then
  ++            io.stderr:write("mtn: base: ERROR: failed to execute \"mtn 
commit\"\n")
  ++            return
  ++        end
  ++        local rc = execute("mtn", "propagate", branch_this, branch_base)
  ++        if rc ~= 0 then
  ++            io.stderr:write("mtn: base: ERROR: failed to execute \"mtn 
propagate\"\n")
  ++            return
  ++        end
  ++        local rc = execute("mtn", "update", "-b", branch_base, "-r", "h:" 
.. branch_base)
  ++        if rc ~= 0 then
  ++            io.stderr:write("mtn: base: ERROR: failed to execute \"mtn 
update\"\n")
  ++            return
  ++        end
   +    end
   +    return
   +end
  @@ .
  patch -p0 <<'@@ .'
  Index: openpkg-src/monotone/monotone.spec
  ============================================================================
  $ cvs diff -u -r1.45 -r1.46 monotone.spec
  --- openpkg-src/monotone/monotone.spec        13 May 2009 10:29:35 -0000      
1.45
  +++ openpkg-src/monotone/monotone.spec        24 Jul 2009 21:24:15 -0000      
1.46
  @@ -32,7 +32,7 @@
   Group:        SCM
   License:      GPL
   Version:      0.44
  -Release:      20090513
  +Release:      20090724
   
   #   package options
   %option       with_rse  yes
  @@ .
______________________________________________________________________
OpenPKG                                             http://openpkg.org
CVS Repository Commit List                     openpkg-cvs@openpkg.org

Reply via email to