chiark / gitweb /
dgit.git
14 months agogit-debrebase: merge: test conflict: Test resolution via patch
Ian Jackson [Sun, 12 Aug 2018 00:16:46 +0000 (01:16 +0100)]
git-debrebase: merge: test conflict: Test resolution via patch

This is a really horrible way to do things.  We need a better
way to let the user help resolve this kind of merge.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: Actually use merge resolutions
Ian Jackson [Sun, 12 Aug 2018 00:25:18 +0000 (01:25 +0100)]
git-debrebase: merge: Actually use merge resolutions

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: Actually record merge resolutions
Ian Jackson [Sun, 12 Aug 2018 00:36:59 +0000 (01:36 +0100)]
git-debrebase: merge: Actually record merge resolutions

And, destroy it on scrap.

Nothing consumes this yet.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: scrap works properly when it does only rebase --abort
Ian Jackson [Sat, 11 Aug 2018 20:59:53 +0000 (21:59 +0100)]
git-debrebase: scrap works properly when it does only rebase --abort

We use @deferred_updates to see if we actually did anything for
--noop-ok purposes.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: test conflict: Break out no-wreckage
Ian Jackson [Sat, 11 Aug 2018 20:57:09 +0000 (21:57 +0100)]
git-debrebase: merge: test conflict: Break out no-wreckage

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: Change wreckage to refs/debrebase/wreckage/*
Ian Jackson [Sat, 11 Aug 2018 20:13:57 +0000 (21:13 +0100)]
git-debrebase: merge: Change wreckage to refs/debrebase/wreckage/*

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agoDgit.pm: Move reflog_cache_* from dgit
Ian Jackson [Sat, 11 Aug 2018 20:11:21 +0000 (21:11 +0100)]
Dgit.pm: Move reflog_cache_* from dgit

We are going to want this for git-debrebase merge resolutions.

NFC other than the usual change to literal `git'.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agoDgit.pm: Move $maindir* up the file.
Ian Jackson [Sat, 11 Aug 2018 20:08:39 +0000 (21:08 +0100)]
Dgit.pm: Move $maindir* up the file.

We're going to want these for the reflog cache functions.

NFC.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agoDgit.pm: Move make_commit_text from dgit
Ian Jackson [Sat, 11 Aug 2018 20:08:00 +0000 (21:08 +0100)]
Dgit.pm: Move make_commit_text from dgit

NFC other than the usual change to literal `git'.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: New record-resolved-merge subcommand, WIP
Ian Jackson [Sat, 11 Aug 2018 19:26:41 +0000 (20:26 +0100)]
git-debrebase: merge: New record-resolved-merge subcommand, WIP

Right now this seems to be able to generate some commit, but
it doesn't know how to record it.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: Split off merge_series_patchqueue_convert
Ian Jackson [Sat, 11 Aug 2018 19:24:47 +0000 (20:24 +0100)]
git-debrebase: merge: Split off merge_series_patchqueue_convert

We're about to reuse this.

NFC.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: Record the new-base in the wreckage.
Ian Jackson [Sat, 11 Aug 2018 19:24:20 +0000 (20:24 +0100)]
git-debrebase: merge: Record the new-base in the wreckage.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: Use a fresh branch and check out again
Ian Jackson [Sat, 11 Aug 2018 19:23:50 +0000 (20:23 +0100)]
git-debrebase: merge: Use a fresh branch and check out again

We are going to want this in a moment.

No overall functional change.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: Introduce $merged_pq
Ian Jackson [Sat, 11 Aug 2018 19:20:49 +0000 (20:20 +0100)]
git-debrebase: merge: Introduce $merged_pq

We are going to want this in a moment.

NFC.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: Use a couple of globals instead
Ian Jackson [Sat, 11 Aug 2018 19:19:08 +0000 (20:19 +0100)]
git-debrebase: merge: Use a couple of globals instead

We are going to make some of this into its own sub, and copying the
convenience functions seems annoying, so do this.

NFC.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: Introduce merge_attempt_cmd global
Ian Jackson [Sat, 11 Aug 2018 19:14:58 +0000 (20:14 +0100)]
git-debrebase: merge: Introduce merge_attempt_cmd global

NFC

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: Do wreckage cleaning separately
Ian Jackson [Sat, 11 Aug 2018 19:13:41 +0000 (20:13 +0100)]
git-debrebase: merge: Do wreckage cleaning separately

git-update-ref hates us if we delete a ref and reintroduce it, in the
same transaction.  In this case we don't mind doing it in two goes.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: fresh_workarea: Support $subdir
Ian Jackson [Sat, 11 Aug 2018 19:13:08 +0000 (20:13 +0100)]
git-debrebase: fresh_workarea: Support $subdir

And use this in merge_series.

NFC.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: Prettify subprocess failures
Ian Jackson [Sat, 11 Aug 2018 18:01:20 +0000 (19:01 +0100)]
git-debrebase: merge: Prettify subprocess failures

If we print STDERR in advance, there is a newline beforehand, which is
undesirable.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: test gdr-merge-conflicts: Test late wreckage
Ian Jackson [Sat, 11 Aug 2018 17:58:16 +0000 (18:58 +0100)]
git-debrebase: merge: test gdr-merge-conflicts: Test late wreckage

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: test gdr-merge-conflicts: Break out wreckage-*
Ian Jackson [Sat, 11 Aug 2018 17:57:52 +0000 (18:57 +0100)]
git-debrebase: merge: test gdr-merge-conflicts: Break out wreckage-*

NFC

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: Minor style and error message change
Ian Jackson [Sat, 11 Aug 2018 17:57:25 +0000 (18:57 +0100)]
git-debrebase: merge: Minor style and error message change

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: Call merge_failed in merge_series
Ian Jackson [Sat, 11 Aug 2018 17:56:18 +0000 (18:56 +0100)]
git-debrebase: merge: Call merge_failed in merge_series

Introduce $attempt_cmd for this purpose.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: Defeat evals which might try to trap merge_failed
Ian Jackson [Sat, 11 Aug 2018 17:55:04 +0000 (18:55 +0100)]
git-debrebase: merge: Defeat evals which might try to trap merge_failed

That would be dangerous because we're in the wrong directory and other
things may be wrong.  For example, if we continue we might overwrite
wreckage with other wreckage.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: Save wreckage in $maindir
Ian Jackson [Sat, 11 Aug 2018 17:51:39 +0000 (18:51 +0100)]
git-debrebase: merge: Save wreckage in $maindir

We should change to $maindir before exiting.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: Always save wreckage
Ian Jackson [Sat, 11 Aug 2018 17:28:59 +0000 (18:28 +0100)]
git-debrebase: merge: Always save wreckage

There is no point configuring this.  We tidy it up again soon enough.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: test suite: Drop check of no wreckage save
Ian Jackson [Sat, 11 Aug 2018 17:22:17 +0000 (18:22 +0100)]
git-debrebase: merge: test suite: Drop check of no wreckage save

We are going to make this nonconfigurable.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: test suite: Check wreckage tidying
Ian Jackson [Sat, 11 Aug 2018 17:19:56 +0000 (18:19 +0100)]
git-debrebase: merge: test suite: Check wreckage tidying

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: Wreckage: tidy it up on successful commands
Ian Jackson [Sat, 11 Aug 2018 17:18:58 +0000 (18:18 +0100)]
git-debrebase: merge: Wreckage: tidy it up on successful commands

Whenever we do a final ref update, discard any wreckage.  The wreckage
can be autoregenerated, so it is not very important.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: Break out merge_wreckage_cleaning (nfc)
Ian Jackson [Sat, 11 Aug 2018 17:09:34 +0000 (18:09 +0100)]
git-debrebase: merge: Break out merge_wreckage_cleaning (nfc)

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: test suite: Check wreckage saving
Ian Jackson [Sat, 11 Aug 2018 17:09:11 +0000 (18:09 +0100)]
git-debrebase: merge: test suite: Check wreckage saving

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: Save wreckage if desired
Ian Jackson [Sat, 11 Aug 2018 17:07:24 +0000 (18:07 +0100)]
git-debrebase: merge: Save wreckage if desired

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: Introduce new merge_failed sub
Ian Jackson [Sat, 11 Aug 2018 17:00:44 +0000 (18:00 +0100)]
git-debrebase: merge: Introduce new merge_failed sub

And call it from $nomerge in walk.  Now we produce a sane error
message.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: Make mwrecknote call printdebug
Ian Jackson [Sat, 11 Aug 2018 16:29:48 +0000 (17:29 +0100)]
git-debrebase: merge: Make mwrecknote call printdebug

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: Miscellaneous mwrecknote fixes
Ian Jackson [Sat, 11 Aug 2018 16:58:57 +0000 (17:58 +0100)]
git-debrebase: merge: Miscellaneous mwrecknote fixes

Add the missing commitish for the -patchqueue wrecknote.

Defend against undef (or too few) args to mwrecknote.
(The way we end up calling it means perl doesn't notice.)

In walk, ensure that we initialise $cl->{MergeWreckNotes}.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: Break out run_ref_updates_now
Ian Jackson [Sat, 11 Aug 2018 16:57:58 +0000 (17:57 +0100)]
git-debrebase: Break out run_ref_updates_now

NFC

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agoDgit.pm: failmsg: Remove all double newlines, not just the first
Ian Jackson [Sat, 11 Aug 2018 16:57:13 +0000 (17:57 +0100)]
Dgit.pm: failmsg: Remove all double newlines, not just the first

I don't think this makes any difference with the current error
messages.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: gdr-merge test: Test an early failure too
Ian Jackson [Sat, 11 Aug 2018 16:31:01 +0000 (17:31 +0100)]
git-debrebase: merge: gdr-merge test: Test an early failure too

And sort out the section comments.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agotest suite: Set DEBFULLNAME
Ian Jackson [Sat, 11 Aug 2018 16:30:04 +0000 (17:30 +0100)]
test suite: Set DEBFULLNAME

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: Introduce global mwrecknote sub
Ian Jackson [Sat, 11 Aug 2018 16:29:34 +0000 (17:29 +0100)]
git-debrebase: merge: Introduce global mwrecknote sub

NFC

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: gdr-merge-conflicts test: New test
Ian Jackson [Sat, 11 Aug 2018 16:01:52 +0000 (17:01 +0100)]
git-debrebase: merge: gdr-merge-conflicts test: New test

Will be improved later.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: gdr-merge test: sort out section comments
Ian Jackson [Sat, 11 Aug 2018 16:01:22 +0000 (17:01 +0100)]
git-debrebase: merge: gdr-merge test: sort out section comments

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: Do not crash on branches with no delta queue
Ian Jackson [Sat, 11 Aug 2018 15:59:18 +0000 (16:59 +0100)]
git-debrebase: merge: Do not crash on branches with no delta queue

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: Do not bail making patches if there aren't any.
Ian Jackson [Sat, 11 Aug 2018 15:56:36 +0000 (16:56 +0100)]
git-debrebase: Do not bail making patches if there aren't any.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: test: Introduce t-merge-conflicted-*
Ian Jackson [Sat, 11 Aug 2018 15:51:54 +0000 (16:51 +0100)]
git-debrebase: merge: test: Introduce t-merge-conflicted-*

NFC

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: test: Drop stuff cloned from gdr-viagit
Ian Jackson [Sat, 11 Aug 2018 15:46:04 +0000 (16:46 +0100)]
git-debrebase: merge: test: Drop stuff cloned from gdr-viagit

We don't much are about this here.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: Add wreck note recording to merge_series
Ian Jackson [Sat, 11 Aug 2018 15:35:51 +0000 (16:35 +0100)]
git-debrebase: merge: Add wreck note recording to merge_series

We also add a LeftRight to the merge base delta queue hashref, so that
it can be treated the same as the left and right delta queues.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: Clarify an internal commit message
Ian Jackson [Sat, 11 Aug 2018 15:35:29 +0000 (16:35 +0100)]
git-debrebase: merge: Clarify an internal commit message

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: Break out $mdebug
Ian Jackson [Sat, 11 Aug 2018 15:35:05 +0000 (16:35 +0100)]
git-debrebase: merge: Break out $mdebug

NFC.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: Pass wreckage hashref to merge_series
Ian Jackson [Sat, 11 Aug 2018 15:27:07 +0000 (16:27 +0100)]
git-debrebase: merge: Pass wreckage hashref to merge_series

NFC so far.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: Introduce $mwrecknote in walk analysis half
Ian Jackson [Sat, 11 Aug 2018 15:23:22 +0000 (16:23 +0100)]
git-debrebase: merge: Introduce $mwrecknote in walk analysis half

We collect various git objects that we may want to present to the user
as wreckage.  Currently we dump them in $cl and print them out in
$nomerge.  We'll want to do better than that of course.

Also, we don't collect any wreckage for the actual series merge yet.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: Whitespace changes
Ian Jackson [Sat, 11 Aug 2018 15:22:12 +0000 (16:22 +0100)]
git-debrebase: merge: Whitespace changes

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: Refactor interchange merge-base computation
Ian Jackson [Sat, 11 Aug 2018 15:13:34 +0000 (16:13 +0100)]
git-debrebase: merge: Refactor interchange merge-base computation

We need to unpack this a bit so that we can insert some wrecknote
stuff, which will come in a moment.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: Fix a $nomerge message
Ian Jackson [Sat, 11 Aug 2018 14:53:02 +0000 (15:53 +0100)]
git-debrebase: merge: Fix a $nomerge message

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: Add a comment about rewriting
Ian Jackson [Sat, 11 Aug 2018 14:52:41 +0000 (15:52 +0100)]
git-debrebase: merge: Add a comment about rewriting

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: Remove a redundant check
Ian Jackson [Sat, 11 Aug 2018 14:48:17 +0000 (15:48 +0100)]
git-debrebase: merge: Remove a redundant check

MergedBreakwaters commits are now handled by a completely other branch
of the if, so this check is now redundant.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: mergedbreakwaters_anchor: Check consistency
Ian Jackson [Sat, 11 Aug 2018 14:39:17 +0000 (15:39 +0100)]
git-debrebase: merge: mergedbreakwaters_anchor: Check consistency

Check that the result contains all the other anchors.  This is
ensured by walk, and required of VanillaMerges.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: Avoid needlessly walking MergedBreakwaters
Ian Jackson [Sat, 11 Aug 2018 14:36:54 +0000 (15:36 +0100)]
git-debrebase: merge: Avoid needlessly walking MergedBreakwaters

We will not ever need to rewrite one of these, so we can just ask
keycommits for its anchor.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: test suite: Use t-ref-same-start
Ian Jackson [Sat, 11 Aug 2018 14:34:51 +0000 (15:34 +0100)]
git-debrebase: merge: test suite: Use t-ref-same-start

This is better than t-gdr-good laundered because (i) it is faster (ii)
it checks that the second laundry was a no-op (and did not rewrite
unnecessarily).

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: test suite: test avoiding re-merge of debian/
Ian Jackson [Sat, 11 Aug 2018 12:48:36 +0000 (13:48 +0100)]
git-debrebase: merge: test suite: test avoiding re-merge of debian/

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: Avoid asking user to re-merge debian/
Ian Jackson [Sat, 11 Aug 2018 12:47:59 +0000 (13:47 +0100)]
git-debrebase: merge: Avoid asking user to re-merge debian/

If it had conflicts, they will have been resolved earlier and we can
just take that resolution.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: test suite: Do a bit more testing
Ian Jackson [Sat, 11 Aug 2018 12:32:28 +0000 (13:32 +0100)]
git-debrebase: merge: test suite: Do a bit more testing

We can now call t-gdr-good laundered, because it works.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agotest suite: lib-gdr: t-gdr-good: Handle MergedBreakwaters
Ian Jackson [Sat, 11 Aug 2018 12:31:58 +0000 (13:31 +0100)]
test suite: lib-gdr: t-gdr-good: Handle MergedBreakwaters

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: Add another xxx comment
Ian Jackson [Sat, 11 Aug 2018 12:31:16 +0000 (13:31 +0100)]
git-debrebase: merge: Add another xxx comment

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: walk: Reintroduce the local $read_tree_upstream sub
Ian Jackson [Sat, 11 Aug 2018 13:57:47 +0000 (14:57 +0100)]
git-debrebase: walk: Reintroduce the local $read_tree_upstream sub

Now that we have the $tree_with_debian parameter to the global
read_tree_upstream, we can use it to avoid the git-write-tree call
and pass $build as the $tree_with_debian.

This thus partially reverts
  dfc092e0ec3d932e51a071000519477d0e33525c
  git-debrebase: Make read_tree_upstream global (nfc)

The combined effect is now that $read_tree_upstream does exactly the
git commands it did before.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: Get debian/ parts of new patch queue right
Ian Jackson [Sat, 11 Aug 2018 12:25:41 +0000 (13:25 +0100)]
git-debrebase: merge: Get debian/ parts of new patch queue right

We want the newly generated delta queue commits to have the $newbase's
debian/.  Previously we let read_tree_upstream save and restore
debian/, but the contents of debian/ in the index are not right:
they're the result of the git merge, which is whatever is left over
from earlier.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: read_tree_upstream: New $tree_with_debian parameter
Ian Jackson [Sat, 11 Aug 2018 12:20:03 +0000 (13:20 +0100)]
git-debrebase: read_tree_upstream: New $tree_with_debian parameter

If not passed, this function does the same as it did before.

NFC.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: Generate some more debugging commits
Ian Jackson [Sat, 11 Aug 2018 11:46:36 +0000 (12:46 +0100)]
git-debrebase: merge: Generate some more debugging commits

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: keycommits: Handle merged-breakwater commits
Ian Jackson [Sat, 11 Aug 2018 11:25:20 +0000 (12:25 +0100)]
git-debrebase: keycommits: Handle merged-breakwater commits

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: keycommits: New $claimed_bw optional argument
Ian Jackson [Sat, 11 Aug 2018 11:24:51 +0000 (12:24 +0100)]
git-debrebase: keycommits: New $claimed_bw optional argument

No users yet, so NFC.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: Generate merged-breakwaters with correct metadata
Ian Jackson [Sat, 11 Aug 2018 11:23:35 +0000 (12:23 +0100)]
git-debrebase: merge: Generate merged-breakwaters with correct metadata

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: keycommits: Break out $found_anchor
Ian Jackson [Sat, 11 Aug 2018 11:22:54 +0000 (12:22 +0100)]
git-debrebase: keycommits: Break out $found_anchor

We are going to want to reuse this.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agotest suite: lib-gdr: t-gdr-good: Introduce t-gdr-analyse
Ian Jackson [Sat, 11 Aug 2018 11:04:37 +0000 (12:04 +0100)]
test suite: lib-gdr: t-gdr-good: Introduce t-gdr-analyse

NFC

This will allow us to recurse.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agotest suite: lib-gdr: t-gdr-good: Introduce $anal
Ian Jackson [Sat, 11 Aug 2018 11:00:24 +0000 (12:00 +0100)]
test suite: lib-gdr: t-gdr-good: Introduce $anal

NFC

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: Check that merge resolution is correct
Ian Jackson [Sat, 11 Aug 2018 10:51:04 +0000 (11:51 +0100)]
git-debrebase: merge: Check that merge resolution is correct

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: Comment about laundry of merge of unstitched
Ian Jackson [Sat, 11 Aug 2018 10:43:40 +0000 (11:43 +0100)]
git-debrebase: merge: Comment about laundry of merge of unstitched

I have concluded that this is not a problem avoidable by
git-debrebase, and that any trouble will be tolerable (at least, not
data loss).  The user should try to avoid doing this.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: Improve some xxx comments
Ian Jackson [Sat, 11 Aug 2018 10:42:53 +0000 (11:42 +0100)]
git-debrebase: merge: Improve some xxx comments

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: test suite: Test both with and without `after'
Ian Jackson [Sat, 11 Aug 2018 10:32:51 +0000 (11:32 +0100)]
git-debrebase: merge: test suite: Test both with and without `after'

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: Do not sometimes drop the first patch!
Ian Jackson [Sat, 11 Aug 2018 10:32:10 +0000 (11:32 +0100)]
git-debrebase: merge: Do not sometimes drop the first patch!

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: Set $debugcmd_when_debuglevel = 2
Ian Jackson [Sat, 11 Aug 2018 09:58:16 +0000 (10:58 +0100)]
git-debrebase: Set $debugcmd_when_debuglevel = 2

This produces much better (less noisy) debug output.  git-debrebase
calls subcommands an awful lot and they are generally very
uninteresting.

If this now turns out to be insufficient, we will add additional calls
to printdebug.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agoDgit.pm: printdebug: Selectively print $debugprefix, and add a doc
Ian Jackson [Sat, 11 Aug 2018 09:52:58 +0000 (10:52 +0100)]
Dgit.pm: printdebug: Selectively print $debugprefix, and add a doc

Remember whether the last printdebug ended in a \n.  If it didn't,
suppress printing the next newline.

I don't think anywhere calls printdebug without @_ right now.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agoDgit.pm: printdebug: Strip empty strings from @_ and maybe quit early
Ian Jackson [Sat, 11 Aug 2018 09:51:14 +0000 (10:51 +0100)]
Dgit.pm: printdebug: Strip empty strings from @_ and maybe quit early

Now the meat of the function always has nonempty $_[-1].

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agoDgit.pm: printdebug: Break apart the print
Ian Jackson [Sat, 11 Aug 2018 09:49:26 +0000 (10:49 +0100)]
Dgit.pm: printdebug: Break apart the print

NFC.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agoDgit.pm: printdebug: Refactor slightly
Ian Jackson [Sat, 11 Aug 2018 09:43:25 +0000 (10:43 +0100)]
Dgit.pm: printdebug: Refactor slightly

This will make the next commits easier.  NFC.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: Reverse argumennts to check diff error message
Ian Jackson [Sat, 11 Aug 2018 09:41:43 +0000 (10:41 +0100)]
git-debrebase: Reverse argumennts to check diff error message

"Old, new" is more conventional.  This makes debug output and error
messages a bit easier to understand.

We must keep the backward order for get_differs because we need to
detect patch deletion, which shows up (reversed) as D_PAT_ADD.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: Add a lot of printdebug
Ian Jackson [Sat, 11 Aug 2018 09:38:06 +0000 (10:38 +0100)]
git-debrebase: Add a lot of printdebug

We also operated on sorted patch lists, and reorganise the prereq
computation slightly, to make this possible.

This `print DEBUG ... if' is not very nice.  This is needed because
printdebug unconditionally prints $debugprefix.  These new debug
prints are nearly the first which want to do multi-stage printing
outside dgit (and dgit normally operates without $debugprefix set).

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agoDgit.pm: Introduce $debugcmd_when_debuglevel
Ian Jackson [Sat, 11 Aug 2018 09:26:48 +0000 (10:26 +0100)]
Dgit.pm: Introduce $debugcmd_when_debuglevel

This is also intended to be usefully localisable, and works by
localising $printdebug_when_debuglevel.

NFC.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agoDgit.pm: Introduce $printdebug_when_debuglevel
Ian Jackson [Sat, 11 Aug 2018 09:26:12 +0000 (10:26 +0100)]
Dgit.pm: Introduce $printdebug_when_debuglevel

This is intended to be usefully localisable.

NFC.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: Detect octopi later
Ian Jackson [Sat, 11 Aug 2018 08:59:31 +0000 (09:59 +0100)]
git-debrebase: merge: Detect octopi later

If git-debrebase or dgit were to make an octopus merge, we should
recognise that as an unknown kind of gdr/dgit merge, not as a general
octopus merge.  This code motion leaves a spot where such a new kind
of merge could be classified.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: merge: Add an xxx
Ian Jackson [Sat, 11 Aug 2018 08:58:57 +0000 (09:58 +0100)]
git-debrebase: merge: Add an xxx

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: test suite: New gdr-merge test
Ian Jackson [Sat, 11 Aug 2018 08:58:05 +0000 (09:58 +0100)]
git-debrebase: test suite: New gdr-merge test

This still has a lot of xxx's, but as it is right now it passes,
despite all the bugs.  This seems like a reasonable baseline for more
work.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: New merge handing, experimental and preliminary
Ian Jackson [Sat, 11 Aug 2018 08:50:04 +0000 (09:50 +0100)]
git-debrebase: New merge handing, experimental and preliminary

Classification:
* Classify octopus merges as unknown, separately
* Classify 2-parent general merges as VanillaMerge, if feature enabled
* Introduce new merged-breakwater commit tag, classify as MergedBreakwaters
* Classify other gdr-generated 2-parent merges as unknown

Inspection (keycommits):
* VanillaMerge commits require laundry, much like dgit imports,
  and prevent discernment of the actual breakwater and anchor

Laundry (walk):
* Rewrite VanillaMerge using new merge_series function

Test suite:
* We get a slightly different error message in gdr-unprocessable, now.
  Later, when we make this non-experimental all the time, we are going
  to have to soup up gdr-unprocessable to make a worse test commit.

There are a lot of known bugs and infelicites, marked with "xxx".
There is a test (which will appear in a moment) but it's rather a poor
test, so there will be many uknown bugs.

So all of this is enabled only if GIT_DEBREBASE_EXPERIMENTAL_MERGE is
set in the environment.  (Strictly, only the classification is gated,
but that is sufficient.)  No significant functional change without
this setting.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: read_tree_upstream: New option $keep_patches
Ian Jackson [Fri, 10 Aug 2018 14:25:31 +0000 (15:25 +0100)]
git-debrebase: read_tree_upstream: New option $keep_patches

NFC with existing callers.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: Improve ffq head recording message
Ian Jackson [Fri, 10 Aug 2018 14:26:09 +0000 (15:26 +0100)]
git-debrebase: Improve ffq head recording message

Say `recorded _previous_ head' rather than `current head'.  Since by
the time the message appears, it's the previous head.  In particular,
`current' is very confusing if there were previous progress messages.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agotest suite: gitattributes: Change a comment from xxx to todo
Ian Jackson [Fri, 10 Aug 2018 13:56:29 +0000 (14:56 +0100)]
test suite: gitattributes: Change a comment from xxx to todo

This is not so critical.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agodgit: Fix a spelling error `$merginputs' to `$mergeinputs'
Ian Jackson [Fri, 10 Aug 2018 13:50:05 +0000 (14:50 +0100)]
dgit: Fix a spelling error `$merginputs' to `$mergeinputs'

No functional change.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agodgit: Drop an obsolete xxx comment
Ian Jackson [Fri, 10 Aug 2018 13:46:03 +0000 (14:46 +0100)]
dgit: Drop an obsolete xxx comment

This comment comes originally from a WIP commit
  e0ebbc5879c01d4c3e802101e146c5fb08bc9d49
I have in before-rebase.2016-11-07.  In that commit, @merginputs
did not exist.  Now it does, and that is how the ref comes out.
So this comment is obsolete.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: Make read_tree_upstream global (nfc)
Ian Jackson [Fri, 10 Aug 2018 13:28:50 +0000 (14:28 +0100)]
git-debrebase: Make read_tree_upstream global (nfc)

Save debian/ explicitly.  This is a bit annoying.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agogit-debrebase: Make read_tree_debian global (nfc)
Ian Jackson [Fri, 10 Aug 2018 11:54:49 +0000 (12:54 +0100)]
git-debrebase: Make read_tree_debian global (nfc)

We can't easily do this to read_tree_upstream because that needs to
put debian/ back which is awkward.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
14 months agotest suite: lib-gdr: Break out t-gdr-prep-new-upstream
Ian Jackson [Fri, 10 Aug 2018 06:45:22 +0000 (07:45 +0100)]
test suite: lib-gdr: Break out t-gdr-prep-new-upstream

This does not include `git tag' for the upstream, because
gdr-newupstream wants to test the case where the tag is missing.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>