Hi,

We are here at DebConf and we found out when you are committing in a feature branch and then you try to import a new upstream release, the commits that you added in the feature branch that are not committed to the debian-branch are lost. This ended up in the attaching patch.

Anyway, it seems counter intuitive that the changes are applied in a different branch. Are you sure that the default behaviour should be to work in the debian-branch instead of the current one?

Happy hacking,
--
"Programs must be written for people to read, and only incidentally for machines to execute."
-- Hal Abelson, "Structure and Interpretation of Computer Programs"
Saludos /\/\ /\ >< `/
From d69ba3a71c77b9e296c400ebf9e08fc4765de9cf Mon Sep 17 00:00:00 2001
From: Maximiliano Curia <[email protected]>
Date: Sat, 20 Jul 2019 21:59:10 -0300
Subject: [PATCH] import-orig/merge_replace Avoid calling force_head

The debian_merge_by_replace function ends up calling force_head, but up
to this point the current branch could be anything, and thus when called from a
feature branch the latest commits get lost.
---
 gbp/scripts/import_orig.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gbp/scripts/import_orig.py b/gbp/scripts/import_orig.py
index 14a87cba..8b0b0fe4 100644
--- a/gbp/scripts/import_orig.py
+++ b/gbp/scripts/import_orig.py
@@ -259,7 +259,9 @@ def debian_branch_merge_by_replace(repo, tag, version, options):
     repo.update_ref("refs/heads/%s" % options.debian_branch, commit,
                     msg="gbp: Updating %s after import of %s" % (options.debian_branch,
                                                                  tag))
-    repo.force_head(commit, hard=True)
+    current_branch = repo.get_branch()
+    if current_branch == options.debian_branch:
+        repo.force_head(commit, hard=True)
 
 
 def debian_branch_merge_by_merge(repo, tag, version, options):
-- 
2.22.0

Attachment: signature.asc
Description: PGP signature

_______________________________________________
git-buildpackage mailing list
[email protected]
http://lists.sigxcpu.org/mailman/listinfo/git-buildpackage

Reply via email to