tag 475571 patch
thanks

Guido Günther <[EMAIL PROTECTED]> writes:

> On Fri, Apr 11, 2008 at 08:32:05PM +0200, Matej Vela wrote:
>> -- I get two disjointed branches:
>> 
>>     o---o---o  <-- upstream
>>      \
>>       o---o---o  <-- master
>
> This is the only sane thing we can do, since we can't be sure upstream has
> merge conflicts with master (if you do any changes outside debian/) and
> the merge would fail. It's basically the reverse of what you describe
> below.

I've been mulling this over, and I think the answer is to treat the
Debian branch as definitive, i.e. merge with strategy "ours".  After
all, any conflicts must have been resolved by the packager, and the
Debian patch is a result of that.

I'm attaching a rough patch.  It does the merge with --no-commit,
applies the Debian patch, then commits it all together.  (The merge is
started before patching because git-merge expects a clean index.)

> This can be avoided if you do a "final" merge [...]

I know, it'd just be nice to have this happen automagically like
everything else with gbp. :-)

Thanks,

Matej
--- git-buildpackage-0.4.29~/gbp/command_wrappers.py
+++ git-buildpackage-0.4.29/gbp/command_wrappers.py
@@ -197,6 +197,13 @@
         self.run_error = 'Couldn\'t switch to branch "%s"' % self.branch
 
 
+class GitMerge(GitCommand):
+    """Wrap git merge (without committing)"""
+    def __init__(self, strategy, branch):
+        GitCommand.__init__(self, 'merge', ['--no-commit', '-s', strategy, 
branch]) 
+        self.run_error = 'Couldn\'t merge "%s" using "%s" strategy' % (branch, 
strategy)
+
+
 class GitPull(GitCommand):
     """Wrap git pull"""
     def __init__(self, repo, branch):
--- git-buildpackage-0.4.29~/git-import-dsc
+++ git-buildpackage-0.4.29/git-import-dsc
@@ -208,6 +208,7 @@
                         gbpc.PristineTar().commit(src.tgz, 
options.upstream_branch)
                 if not src.native:
                     gbpc.GitCheckoutBranch(options.debian_branch)()
+                    gbpc.GitMerge('ours', options.upstream_branch)()
                     replace_source_tree(repo, unpack_dir, options.filters)
                     apply_debian_patch(src, dirs, options)
     except gbpc.CommandExecFailed:

Reply via email to