From: Catalin Marinas <catalin.marinas@gmail.com>
To: "Karl Hasselström" <kha@treskal.com>
Cc: git@vger.kernel.org
Subject: Re: [RFC][StGit PATCH] Add support for merge-friendly branches
Date: Fri, 29 May 2009 11:13:14 +0100 [thread overview]
Message-ID: <b0943d9e0905290313gc37d98cy769f57a4715cae14@mail.gmail.com> (raw)
In-Reply-To: <b0943d9e0905290140i57aeaa33r8de34302b63ffa5e@mail.gmail.com>
2009/5/29 Catalin Marinas <catalin.marinas@gmail.com>:
> merge_bases = repository.get_merge_bases(public_head, stack.base)
> if not stack.base in merge_bases:
> public_head = __create_commit(repository, stack.head.data.tree,
> [public_head, stack.base], options)
> repository.refs.set(public_ref, public_head, 'publish')
> out.info('Merged the stack base into "%s"' % public_ref)
> return
One minor improvement here, trying to guess what was merged:
diff --git a/stgit/commands/publish.py b/stgit/commands/publish.py
index fe7f7c6..401fbdf 100644
--- a/stgit/commands/publish.py
+++ b/stgit/commands/publish.py
@@ -67,10 +67,10 @@ options = [
directory = common.DirectoryHasRepositoryLib()
-def __create_commit(repository, tree, parents, options):
+def __create_commit(repository, tree, parents, options, message = ''):
"""Return a new Commit object."""
cd = git.CommitData(
- tree = tree, parents = parents, message = '',
+ tree = tree, parents = parents, message = message,
author = git.Person.author(), committer = git.Person.committer())
cd = common.update_commit_data(cd, options, allow_edit = True)
@@ -106,8 +106,10 @@ def func(parser, options, args):
# base by setting two parents.
merge_bases = repository.get_merge_bases(public_head, stack.base)
if not stack.base in merge_bases:
+ message = 'Merge ' + repository.describe(stack.base)
public_head = __create_commit(repository, stack.head.data.tree,
- [public_head, stack.base], options)
+ [public_head, stack.base], options,
+ message)
repository.refs.set(public_ref, public_head, 'publish')
out.info('Merged the stack base into "%s"' % public_ref)
return
diff --git a/stgit/lib/git.py b/stgit/lib/git.py
index 3303eea..6e3bb4f 100644
--- a/stgit/lib/git.py
+++ b/stgit/lib/git.py
@@ -614,6 +614,10 @@ class Repository(RunWithEnv):
sha1_list = self.run(['git', 'merge-base', '--all',
commit1.sha1, commit2.sha1]).output_lines()
return set(self.get_commit(sha1) for sha1 in sha1_list)
+ def describe(self, commit):
+ """Use git describe --all on the given commit."""
+ return self.run(['git', 'describe', '--all', commit.sha1]
+ ).discard_stderr().discard_exitcode().raw_output()
def simple_merge(self, base, ours, theirs):
index = self.temp_index()
try:
--
Catalin
next prev parent reply other threads:[~2009-05-29 10:14 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-28 11:12 [RFC][StGit PATCH] Add support for merge-friendly branches Catalin Marinas
[not found] ` <20090528111212.21925.45527.stgit-hhZApKj8DF/YkXV2EHHjLW3o5bpOHsLO@public.gmane.org>
2009-05-28 12:12 ` Fwd: " martin f krafft
2009-05-28 12:48 ` Karl Hasselström
2009-05-28 14:38 ` Catalin Marinas
2009-05-28 14:51 ` Catalin Marinas
2009-05-29 7:20 ` Karl Hasselström
2009-05-29 8:40 ` Catalin Marinas
2009-05-29 9:12 ` Karl Hasselström
2009-05-29 10:13 ` Catalin Marinas [this message]
2009-05-29 8:37 ` Karl Hasselström
2009-05-29 9:16 ` Catalin Marinas
2009-05-29 11:59 ` Karl Hasselström
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b0943d9e0905290313gc37d98cy769f57a4715cae14@mail.gmail.com \
--to=catalin.marinas@gmail.com \
--cc=git@vger.kernel.org \
--cc=kha@treskal.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).