2009/5/29 Catalin Marinas <catalin.marinas@xxxxxxxxx>: > 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 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html