summaryrefslogtreecommitdiff
path: root/git-debrebase
diff options
context:
space:
mode:
Diffstat (limited to 'git-debrebase')
-rwxr-xr-xgit-debrebase39
1 files changed, 39 insertions, 0 deletions
diff --git a/git-debrebase b/git-debrebase
index b70f8d9..50f5e16 100755
--- a/git-debrebase
+++ b/git-debrebase
@@ -990,6 +990,45 @@ END
# now it's for the user to sort out
}
+sub cmd_gbp2debrebase () {
+ badusage "needs 1 optional argument, the upstream" unless @ARGV<=1;
+ my ($upstream_spec) = @ARGV;
+ $upstream_spec //= 'refs/heads/upstream';
+ my $upstream = git_rev_parse $upstream_spec;
+ my $old_head = get_head();
+
+ my $upsdiff = get_differs $upstream, $old_head;
+ if ($upsdiff & D_UPS) {
+ runcmd @git, qw(--no-pager diff),
+ $upstream, $old_head,
+ qw( -- :!/debian :/);
+ fail "upstream ($upstream_spec) and HEAD are not identical in upstream files";
+ }
+
+ if (!is_fast_fwd $upstream, $old_head) {
+ fproblem "upstream ($upstream) is not an ancestor of HEAD";
+ } else {
+ my $wrong = cmdoutput
+ (@git, qw(rev-list --ancestry-path), "$upstream..HEAD",
+ qw(-- :/ :!/debian));
+ if (length $wrong) {
+ fproblem "history between upstream ($upstream) and HEAD contains direct changes to upstream files - are you sure this is a gbp (patches-unapplied) branch?";
+ print STDERR "list expected changes with: git log --stat --ancestry-path $upstream_spec..HEAD -- :/ ':!/debian'\n";
+ }
+ }
+
+ if ((git_cat_file "$upstream:debian")[0] ne 'missing') {
+ fproblem "upstream ($upstream) contains debian/ directory";
+ }
+ die;
+
+ fresh_workarea();
+ in_workarea sub {
+ runcmd @git, qw(checkout -b work), $old_head;
+
+ };
+}
+
sub cmd_downstream_rebase_launder_v0 () {
badusage "needs 1 argument, the baseline" unless @ARGV==1;
my ($base) = @ARGV;