Package: git-buildpackage Version: 0.6.0~git20120419 Severity: wishlist Tags: patch
Dear Maintainer, During my work on #669171, I found useful to have a wrapper to "git merge-base". I include the patch for review followed by a pull request. Regards. From e375b4f9fb4654159e1efcfae4a14a513234c683 Mon Sep 17 00:00:00 2001 From: Daniel Dehennin <daniel.dehen...@baby-gnu.org> Date: Sat, 12 May 2012 17:00:24 +0200 Subject: [PATCH] Add "git merge-base" wrapper. * gbp/git/repository.py (GitRepository.get_merge_base): New method which return SHA1 of a common ancestor between to commits. --- gbp/git/repository.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/gbp/git/repository.py b/gbp/git/repository.py index 2cc5eda..a02d4ef 100644 --- a/gbp/git/repository.py +++ b/gbp/git/repository.py @@ -299,6 +299,21 @@ class GitRepository(object): remote += merge.replace("refs/heads","", 1) return remote + def get_merge_base(self, commit1, commit2): + """ + Get the common ancestor between two commits + The commits can be SHA1 or names of branch or tag + + @return: SHA1 of the common ancestor + @rtype: C{str} + """ + args = [commit1, commit2] + sha1, stderr, ret = self._git_inout('merge-base', args) + if not ret: + return sha1.strip() + else: + raise GbpError("Failed to get common ancestor: %s" % stderr) + def merge(self, commit, verbose=False, edit=False): """ Merge changes from the named commit into the current branch -- 1.7.10 The following changes since commit 5de6410bc6c5155c38caa332321c8fe0087f819f: docs: compolete git-dch synopsis (2012-05-06 22:54:54 +0200) are available in the git repository at: git://git.baby-gnu.org/git-buildpackage tags/dad/add-git-merge-base-wrapper for you to fetch changes up to e375b4f9fb4654159e1efcfae4a14a513234c683: Add "git merge-base" wrapper. (2012-05-12 17:09:20 +0200) ---------------------------------------------------------------- This wrapper is needed for debian bug #669171. ---------------------------------------------------------------- Daniel Dehennin (1): Add "git merge-base" wrapper. gbp/git/repository.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) -- System Information: Debian Release: wheezy/sid APT prefers unstable APT policy: (500, 'unstable'), (500, 'testing'), (90, 'experimental') Architecture: amd64 (x86_64) Kernel: Linux 3.2.4+hati.1+ (SMP w/2 CPU cores; PREEMPT) Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash Versions of packages git-buildpackage depends on: ii devscripts 2.11.6 ii git 1:1.7.10-1 ii python 2.7.2-10 ii python-dateutil 1.5-1 ii python2.6 2.6.7-4 ii python2.7 2.7.3~rc2-2.1 Versions of packages git-buildpackage recommends: ii cowbuilder <none> ii pristine-tar 1.24 Versions of packages git-buildpackage suggests: ii python-notify 0.1.1-3 ii unzip 6.0-6 -- no debconf information -- debsums errors found: debsums: changed file /usr/share/pyshared/gbp/deb/changelog.py (from git-buildpackage package) debsums: changed file /usr/share/pyshared/gbp/scripts/dch.py (from git-buildpackage package) -- Daniel Dehennin Récupérer ma clef GPG: gpg --keyserver pgp.mit.edu --recv-keys 0x7A6FE2DF
pgp3QZrm84OHO.pgp
Description: PGP signature