diff options
author | Daniel Silverstone <dsilvers@digital-scurf.org> | 2012-08-05 16:55:19 +0100 |
---|---|---|
committer | Daniel Silverstone <dsilvers@digital-scurf.org> | 2012-08-05 16:55:19 +0100 |
commit | e20de43024c513f6f8f9c861d86458cb7b6b47d3 (patch) | |
tree | 355d38d4f3fe73349e9f0600d5d51af674cad82e | |
parent | 8cd22bf8eeee615093f26726ccca4619ebd158d3 (diff) | |
download | gitano-e20de43024c513f6f8f9c861d86458cb7b6b47d3.tar.gz |
CIA: Report rebases and large pushes in a more controlled manner
-rw-r--r-- | lib/gitano/actions.lua | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/lib/gitano/actions.lua b/lib/gitano/actions.lua index 37670c5..0a5152a 100644 --- a/lib/gitano/actions.lua +++ b/lib/gitano/actions.lua @@ -101,7 +101,30 @@ local function cia_branch_update_gen(project, branch, repo, previoustip, newtip) local revs = repo.git:rev_list(previoustip, newtip, true) local commits = {} - for i = #revs, 1, -1 do + + local base, msg = repo.git:merge_base(previoustip, newtip) + local is_rebase = false + if not base then + gitano.log.fatal(msg) + elseif (base == true) or ((base) and (base == newtip)) then + is_rebase = true + else + is_rebase = false + end + + local suffix = "" + local nrevs = #revs + if is_rebase then + nrevs = 1 + suffix = "+rebase" + else + if nrevs > 4 then + nrevs = 3 + suffix = "+more" + end + end + + for i = nrevs, 1, -1 do local commit = repo.git:get(revs[i]) local author = commit.content.author author = ("%s <%s>"):format(author.realname, author.email) @@ -141,10 +164,11 @@ local function cia_branch_update_gen(project, branch, repo, ([[<file action="%s"%s>%s</file>]]):format(unpack(fmts)) end filelist = table.concat(filelist, "\n ") - local com_msg = cia_commit_pattern:format(commit.sha:sub(1,7), + local com_msg = cia_commit_pattern:format(commit.sha:sub(1,7) .. suffix, filelist, author, logline) + suffix = "" commits[#commits+1] = cia_pattern:format(project, branch, com_msg) end |