]> git.neil.brown.name Git - wiggle.git/log
wiggle.git
10 years agomerge: fix reporting of empty "conflicts".
NeilBrown [Mon, 19 Aug 2013 05:03:37 +0000 (15:03 +1000)]
merge: fix reporting of empty "conflicts".

The important part of this patch is the end in print_merge().
If one conflict follows another with nothing in between,
then we really should try to mark up that 'nothingness' as
a resolved conflict.

The other parts as just cleaning up isolate_conflicts a bit more
as I tried to figure out what was happening.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agotests: new test case for stray &&&&&
NeilBrown [Mon, 19 Aug 2013 05:00:50 +0000 (15:00 +1000)]
tests: new test case for stray &&&&&

We sometime get stray empty conflicts, particularly with &&&&&&
even though show-wiggles wasn't requested.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoBrowser: Don't highlight spaces so much.
NeilBrown [Mon, 19 Aug 2013 01:15:53 +0000 (11:15 +1000)]
Browser: Don't highlight spaces so much.

Highlighting spaces is very noisy and doesn't help very much.
We only really need to differentiate spaces from tabs and highlighting
tabs is enough for that.

We continue to highlight spaces that are adjacent to tabs, but not
other spaces.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoUnwrap some printf string.
NeilBrown [Mon, 19 Aug 2013 01:00:11 +0000 (11:00 +1000)]
Unwrap some printf string.

Have long lines is much better than having to break strings in odd places.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoBrowser help: add some missing commas.
NeilBrown [Mon, 19 Aug 2013 00:59:29 +0000 (10:59 +1000)]
Browser help: add some missing commas.

The missing commas would just to lines into one.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agoExtract version information from 'git' if possible.
NeilBrown [Thu, 28 Mar 2013 01:53:57 +0000 (12:53 +1100)]
Extract version information from 'git' if possible.

The version number (and date) reported by "wiggle -V" now
includes information from 'git' if the code was build from a
git repo rather than from a tar-ball.

Suggested-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: NeilBrown <neilb@suse.de>
11 years agomerge: be more careful about aligning hunk-headers with newlines.
NeilBrown [Fri, 22 Mar 2013 04:12:49 +0000 (15:12 +1100)]
merge: be more careful about aligning hunk-headers with newlines.

When matching a diff to a file, it would be very confusing.
if the last match from one hunk were on the same line of the
original as the first match of the next hunk.
So we try to align hunk-headers with newlines.

In particular, we often find Unmatched and Extraneous
sections together.  There can be encoded in any order.
If the Extraneous section contains a hunk-header,
we want to make sure that if there is a newline anywhere
in the unmatched section, then the Unmatched that is placed
before the hunk-headers Extraneous ends on a newline.

There was code the attempted this, but it was too simplistic
and would sometimes move outside the regions that it should
have been examine, which would lead to various bugs.

The tests case which demonstrated this is added to the
test suite.

Reported-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: NeilBrown <neilb@suse.de>
11 years agocsl_join should merge adjacent matches.
NeilBrown [Fri, 22 Mar 2013 04:04:48 +0000 (15:04 +1100)]
csl_join should merge adjacent matches.

When diffing against a patch we treat each hunk separately
and join the result.
This joining doesn't merge adjacent matches so it doesn't really
tell the full story of where the matches are and how big
they are.  This can confuse other code, particularly when
examining hunk headers to create the merger.

So add detection for adjacent matches.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agomerge: calculate number of wiggles more accurately.
NeilBrown [Thu, 7 Mar 2013 03:09:46 +0000 (14:09 +1100)]
merge: calculate number of wiggles more accurately.

Assess wiggles the same way that we assess conflict,
and then count the number of each.
This gives more meaningful counts.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agomerge: tidy up isolation of conflicts.
NeilBrown [Thu, 7 Mar 2013 02:10:02 +0000 (13:10 +1100)]
merge: tidy up isolation of conflicts.

We want to isolate (and these count) wiggles much
like we do conflicts, but the conflict isolating
code is just confusing.

So try to make it a bit cleaner, and defined clearly
the various states.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agovpatch: restore display for hunk header where appropriate.
NeilBrown [Tue, 5 Mar 2013 04:36:50 +0000 (15:36 +1100)]
vpatch: restore display for  hunk header where appropriate.

Recent patch broke this.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agoAdd --ignore-blanks option.
NeilBrown [Tue, 5 Mar 2013 04:00:17 +0000 (15:00 +1100)]
Add --ignore-blanks option.

This can be useful when people re-flow you text or otherwise
introduce space-damange that just really isn't interesting.

Suggested-by: Tom Scogland <tom.scogland@vt.edu>
Signed-off-by: NeilBrown <neilb@suse.de>
11 years agovpatch: allow a word to have text before the newline.
NeilBrown [Fri, 1 Mar 2013 08:09:35 +0000 (19:09 +1100)]
vpatch: allow a word to have text before the newline.

Previously we don't print out ends_line() words at all.
But soon a word might have some content plus a newline at
the end.
So restructure the display to print non-newline characters
from any word.
Note that we cannot have characters *after* a newline.
Doing that would break too much of wiggle's formating
assumptions.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agoAllow a word to have an unmatched prefix and suffix.
NeilBrown [Fri, 1 Mar 2013 08:05:27 +0000 (19:05 +1100)]
Allow a word to have an unmatched prefix and suffix.

i.e. The part of a word that is tested for matching is
shorted than the whole word that is printed.  There can
be a prefix and a suffix.  In a future patch, an option
will be availble to include most spaces as prefix or suffix
of nearby non-space.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agodiscard ends_mline, just use ends_line
NeilBrown [Fri, 1 Mar 2013 07:56:34 +0000 (18:56 +1100)]
discard ends_mline, just use ends_line

There is no important difference between ends_mline and ends_line (any
more), so just discard the former.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agovpatch: restructure draw_mside.
NeilBrown [Fri, 1 Mar 2013 07:46:00 +0000 (18:46 +1100)]
vpatch: restructure draw_mside.

We have the end-of-line handing code in the middle of
a 'while', and the only return from the function is at
the end of the eol handling.  And there is nothing after the "while".

So move the eol handling code out of the while, and just put
a "break" in place of it.

No functionality change.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agoRemove duplicate definition of "csl_join"
NeilBrown [Fri, 1 Mar 2013 05:52:10 +0000 (16:52 +1100)]
Remove duplicate definition of "csl_join"

We really only need one of these.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agomerge: Remove noise from --show-wiggles output.
NeilBrown [Fri, 1 Mar 2013 05:02:15 +0000 (16:02 +1100)]
merge: Remove noise from --show-wiggles output.

When --show-wiggles is used with whole files (current, orig, new) and
extraneous text in orig/new (Which isn't a change, so should be
ignored) is treated as a wiggle and causes a conflict to be shown.
Obviously not good.

So insist that any show-wiggle conflict contains at leas a Changed or
a Conflict.  Also allow Changed and Unmatched to be 'near' each other,
not only on the same line, to signal a wiggle.  Current 'near' measure
is 3 lines.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agovpatch: fix browse of three-file merge.
NeilBrown [Wed, 20 Feb 2013 04:19:42 +0000 (15:19 +1100)]
vpatch: fix browse of three-file merge.

Due to a flag problem, it was ignoring the second and third files.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agotests: add 'merge' test for linux/raid5
NeilBrown [Tue, 19 Feb 2013 05:20:43 +0000 (16:20 +1100)]
tests: add 'merge' test for linux/raid5

We had the orig and the patch, but no actual tests here.
Strange.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agoAdd valgrind testing of parts of vpatch.
NeilBrown [Thu, 14 Feb 2013 06:31:18 +0000 (17:31 +1100)]
Add valgrind testing of parts of vpatch.

With --self-test, browsing a simple merge will simply
display at every line.
"make vtest" will run this for every merge in the test suite
and use valgrind to look for problems.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agoAdd "make valgrind"
NeilBrown [Thu, 14 Feb 2013 05:53:42 +0000 (16:53 +1100)]
Add "make valgrind"

This runs the test suite under valgrind and complains if any
errors are detected.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agomerge: remove some meaningless AlreadyApplied
NeilBrown [Thu, 14 Feb 2013 05:40:50 +0000 (16:40 +1100)]
merge: remove some meaningless AlreadyApplied

Finding an AlreadyApplied amid Conflicts and Extraneous etc is
unlikely to be helpful.  So don't do it.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agobestmatch: improve poor matches.
NeilBrown [Thu, 14 Feb 2013 05:30:29 +0000 (16:30 +1100)]
bestmatch: improve poor matches.

If the bestmatch doens't include all of the lines in a hunk, try to
find matches between the unmatch parts of the hunk, and surrounding
text in the original.

This is particularly useful when some of the context is just blank
lines.  The best-match algorithm might ignore blank lines because they
aren't big enough to justify much distance from the rest of the match.

This makes tests/linux/raid1-A/merge a lot nicer.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agomerge: remove useless context from the end of a conflict.
NeilBrown [Wed, 13 Feb 2013 23:45:57 +0000 (10:45 +1100)]
merge: remove useless context from the end of a conflict.

If we are close to the end-of-file, then don't expect
too many unchanged lines.
And allow zero lines of context in the merge if  it is unchanged out
side the merge.

Update various tests to match - all clear improvements.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agomerge: remove useless context at the start of a conflict.
NeilBrown [Wed, 13 Feb 2013 23:22:18 +0000 (10:22 +1100)]
merge: remove useless context at the start of a conflict.

There are two fixes here.

The first allows the newline at the end of an unchanged region to be
the 'first' newline found so that if there are several others to
provide backup, it will be used.

The second allows the start-of-file to be strong enough context to
not require three full lines of explicit context.

Then we change a lot of the self-tests to match.  In each case the
result is a clear improvement.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agovpatch: fix another access-beyond-array
NeilBrown [Wed, 13 Feb 2013 06:28:30 +0000 (17:28 +1100)]
vpatch: fix another access-beyond-array

This was found by valgrind as well: prev_melmnt needs to check
'type' just like next_melmnt does.

This  revealed an infinite loop because we have a 'hi' value that
was wrong but being trusted.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agovpatch: allow relevant signals to cause a core-dump.
NeilBrown [Tue, 12 Feb 2013 04:00:38 +0000 (15:00 +1100)]
vpatch: allow relevant signals to cause a core-dump.

We catch SIGBUS and SIGSEGV so the terminal can be reset.
But that means we don't see a core dump if there should be one.

So for those signals, clear the signal handler after reseting
the terminal, and return.  Then the core will be dumped.

Reported-by: Paul Wise <pabs3@bonedaddy.net>
11 years agovpatch: fix various reference errors found by valgrind.
NeilBrown [Tue, 12 Feb 2013 03:47:51 +0000 (14:47 +1100)]
vpatch: fix various reference errors found by valgrind.

We sometimes fall of the end, or the start, of various arrays,
or use variables we haven't initialised.

Reported-by: Paul Wise <pabs3@bonedaddy.net>
Signed-off-by: NeilBrown <neilb@suse.de>
11 years agoBrowser: add missing documentation for Save and Restore in main window
NeilBrown [Thu, 7 Feb 2013 00:07:05 +0000 (11:07 +1100)]
Browser: add missing documentation for Save and Restore in main window

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agodiff: make rediffing of patches more precise.
NeilBrown [Wed, 6 Feb 2013 23:38:15 +0000 (10:38 +1100)]
diff: make rediffing of patches more precise.

When wiggle is given a patch, it splits it into a 'before' and an
'after' section and creates a diff between those.
The hunks in the patch are separated by headers and it is assumed that
these headers will line up in the result.

However: if one hunk removes a chunk of test and  another hunk adds
that chunk of text, the chunk may appear more significant than the
hunk headers, so it will line up, and the hunk headers won't
This creates a mess as one of the current tests shows, and as a
newly added test demonstrates quite neatly.

So if we are re-diffing a patch, find the hunk headers and only
diff the bits between them.

This allows the new test to work, and improves the result of the old
test.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agoDOC: remove diff.ps due to distribution license issues.
NeilBrown [Mon, 4 Feb 2013 22:57:56 +0000 (09:57 +1100)]
DOC: remove diff.ps due to distribution license issues.

Replace with DOC/Algorithm which refers to the original document
and explains some of the differences.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agovpatch: add mouse movement to merge_window.
NeilBrown [Thu, 15 Nov 2012 05:39:02 +0000 (16:39 +1100)]
vpatch: add mouse movement to merge_window.

If you click in the 'other' pane, just jump to that pane.
If you click in the same pane, go to the character.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agovpatch: add mouse support for main window.
NeilBrown [Thu, 15 Nov 2012 05:09:13 +0000 (16:09 +1100)]
vpatch: add mouse support for main window.

Clicking on a line will cause that file or folder to be
opened.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agoMan page updates.
NeilBrown [Thu, 15 Nov 2012 04:59:59 +0000 (15:59 +1100)]
Man page updates.

Various typo, recent changes, and more info about Browsing.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agovpatch: allow control-C to disable --replace function.
NeilBrown [Thu, 15 Nov 2012 04:18:21 +0000 (15:18 +1100)]
vpatch: allow control-C to disable --replace function.

This requires 'raw' mode instead of just 'cbreak'.  I guess it is time.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agovpatch: handle --replace option.
NeilBrown [Thu, 15 Nov 2012 04:13:28 +0000 (15:13 +1100)]
vpatch: handle --replace option.

If --replace if given, then we save without prompting.
Without --replace we only prompt of something has been changed or
saved manually.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agovpatch: add X command to ignore all changes in the line.
NeilBrown [Thu, 15 Nov 2012 03:07:09 +0000 (14:07 +1100)]
vpatch: add X command to ignore all changes in the line.

'X' will toggle the ignoring of all Conflict and Changeds in
the current line.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agovpatch: make sure render is stable when the merge is changed.
NeilBrown [Thu, 15 Nov 2012 02:46:33 +0000 (13:46 +1100)]
vpatch: make sure render is stable when the merge is changed.

If we are in the main window and pos suddenly is not 'visible',
we need to jump to the new, visible, pos.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agovpatch: allow changes to be ignored as well as conflict.
NeilBrown [Thu, 15 Nov 2012 02:45:51 +0000 (13:45 +1100)]
vpatch: allow changes to be ignored as well as conflict.

Because sometimes a 'change' that is found is really a conflict.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agovpatch: fix display for ignored conflicts.
NeilBrown [Thu, 15 Nov 2012 01:23:59 +0000 (12:23 +1100)]
vpatch: fix display for ignored conflicts.

We need to make sure we display the 'before' bit, not just
hide the 'after' bit.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agovpatch: add "control-X-O" as a watch to change panes.
NeilBrown [Thu, 15 Nov 2012 00:10:23 +0000 (11:10 +1100)]
vpatch: add "control-X-O" as a watch to change panes.

My emacs-fingers want to do that, so let them.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agovpatch: allow mode setting keys to toggle back to 'merge'.
NeilBrown [Wed, 14 Nov 2012 23:59:04 +0000 (10:59 +1100)]
vpatch: allow mode setting keys to toggle back to 'merge'.

When I set the mode to anything other than 'merge', I usually want to
then go straight back to 'merge'.  And if someone does it by mistake,
a toggle function is easier to guess.

So make all mode setting commands toggle between their mode, and
'merge'.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agovpatch: change appearance of ignored conflicts.
NeilBrown [Wed, 14 Nov 2012 23:43:26 +0000 (10:43 +1100)]
vpatch: change appearance of ignored conflicts.

I'm not sure about this yet, but ignored conflicts should look
a bit different to normal ones, so remove some of the highlight.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agovpatch: update status counters when we save a file.
NeilBrown [Wed, 14 Nov 2012 23:36:13 +0000 (10:36 +1100)]
vpatch: update status counters when we save a file.

So that 'conflicts', 'wiggles', and 'chunks' remain correct.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agovpatch: add 'C' command to go to next conflicted hunk.
NeilBrown [Wed, 14 Nov 2012 23:23:59 +0000 (10:23 +1100)]
vpatch: add 'C' command to go to next conflicted hunk.

This makes it easy to find conflicts.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agovpatch: highlight conflicts better.
NeilBrown [Wed, 14 Nov 2012 23:17:38 +0000 (10:17 +1100)]
vpatch: highlight conflicts better.

You can only tell the difference between a conflict and a
change by the conflict starting with '|', not '-'.
So make that '|' more visible, because conflicts are important.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agovpatch: update display correctly when editing the merge.
NeilBrown [Wed, 14 Nov 2012 23:07:19 +0000 (10:07 +1100)]
vpatch: update display correctly when editing the merge.

If an edit changes the merge so that we don't need to show
two separate streams any more, then the display must be updated
to not show the stream.
And the reverse.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agovpatch: conditionally auto-save unsaved files when aborting browser.
NeilBrown [Wed, 14 Nov 2012 05:38:54 +0000 (16:38 +1100)]
vpatch: conditionally auto-save unsaved files when aborting browser.

Maybe this should be conditional on a commandline switch.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agovpatch: avoid repeated backups.
NeilBrown [Wed, 14 Nov 2012 05:10:15 +0000 (16:10 +1100)]
vpatch: avoid repeated backups.

If we have already saved a merge, taking a backup, then don't take further
backups - pointless and possibly distructive.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agovpatch: prompt to save change if merge was editted.
NeilBrown [Wed, 14 Nov 2012 05:05:27 +0000 (16:05 +1100)]
vpatch: prompt to save change if merge was editted.

Not much editting is possible yet, but if it is done, we might
want to save, or discard, or continue editing.

The 'help' window is retasked to alternatively be a 'query' window.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agovpatch: allow a save file to be restored.
NeilBrown [Wed, 14 Nov 2012 02:58:57 +0000 (13:58 +1100)]
vpatch: allow a save file to be restored.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agovpatch: support saving of files.
NeilBrown [Wed, 14 Nov 2012 02:50:35 +0000 (13:50 +1100)]
vpatch: support saving of files.

'S' will save the current file.  If you try to enter
it again, it will be loaded as a 'merge'.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agovpatch: Allow a message to be displayed in main folder.
NeilBrown [Wed, 14 Nov 2012 02:45:02 +0000 (13:45 +1100)]
vpatch: Allow a message to be displayed in main folder.

So when we act on a file, it won't be invisible.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agoSeparate make_merger out from print_merge2
NeilBrown [Wed, 14 Nov 2012 01:45:23 +0000 (12:45 +1100)]
Separate make_merger out from print_merge2

Will want to print a 'merger' that we have modified.  So don't
call make_merger from print_merge, call it before hand and pass it in.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agovpatch: remove lots of memory leaks.
NeilBrown [Tue, 13 Nov 2012 06:45:53 +0000 (17:45 +1100)]
vpatch: remove lots of memory leaks.

Thanks for valgrind for making it easy to find these.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agovpatch: allow a file in list to be a 'merger' instead of a patched file.
NeilBrown [Tue, 13 Nov 2012 05:59:10 +0000 (16:59 +1100)]
vpatch: allow a file in list to be a 'merger' instead of a patched file.

This will be useful once we can save files - the result of a save is
a merger.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agovpatch: allow conflict to be ignored with 'x'
NeilBrown [Tue, 13 Nov 2012 05:56:04 +0000 (16:56 +1100)]
vpatch: allow conflict to be ignored with 'x'

Patch still under development

11 years agovpatch: change args to visible()
NeilBrown [Tue, 13 Nov 2012 03:38:03 +0000 (14:38 +1100)]
vpatch: change args to visible()

The type and stream passed to visible() are always generate from
a merge and an mpos in the same way.  So pass the merge and mpos
instead.
This makes more information available to visible() which will be used
in a future patch.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agovpatch: avoid extra blanks when cursor is in alternate pane.
NeilBrown [Tue, 13 Nov 2012 02:59:41 +0000 (13:59 +1100)]
vpatch: avoid extra blanks when cursor is in alternate pane.

When cursor is in the 'diff' pane of the 'merge' view, the line it is
on might not be visible in the main pane.  This can cause ugly a_void
lines to appear.
So make sure there point we refresh is a visible point.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agovpatch: add 'space' and 'backspace' for page up/down.
NeilBrown [Tue, 13 Nov 2012 01:24:48 +0000 (12:24 +1100)]
vpatch: add 'space' and 'backspace' for page up/down.

Makes movement a bit easier.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agovpatch: highlight spaces when they might be important.
NeilBrown [Tue, 13 Nov 2012 01:19:26 +0000 (12:19 +1100)]
vpatch: highlight spaces when they might be important.

If a wiggle is needed due to white-space issues, it is good
to show them.
So in cases where that might be happening - unmatches space or
extraneous space - highlight spaces as inverse-video and tabs as
underlines.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agovpatch: make ctrl-G search-again-forward, not just search-again.
NeilBrown [Tue, 13 Nov 2012 00:39:33 +0000 (11:39 +1100)]
vpatch: make ctrl-G search-again-forward, not just search-again.

As ctrl-S doesn't work (as I haven't enabled 'raw' mode), you cannot
search forward during a reverse search.  So change ctrl-G to do that
rather than search-again-in-current-direction, which isn't really useful.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agovpatch: fix check_line to stop at hunk headers.
NeilBrown [Tue, 13 Nov 2012 00:16:09 +0000 (11:16 +1100)]
vpatch: fix check_line to stop at hunk headers.

check_line() includes invisible bits because they could in some sense
be part of 'this' line.  It ignore hunk headers, but it really should stop
at them, because nothing before could be related to this line.

This fixes a problem where 'N' and 'P' would find hunk headers
which isn't really helpful.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agovpatch: ensure searching for 'next change' works.
NeilBrown [Mon, 12 Nov 2012 23:57:45 +0000 (10:57 +1100)]
vpatch: ensure searching for 'next change' works.

Now that AlreadyApplied may not cause multiple streams  in the
merge window, we need to be more carefuly about searching for changes.
i.e. we need to check each line to see if it is at-or-near an
interesting change.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agovpatch: revise the exact meaning of 'CHANGES'.
NeilBrown [Mon, 12 Nov 2012 23:33:40 +0000 (10:33 +1100)]
vpatch: revise the exact meaning of 'CHANGES'.

The 'CHANGES' flag now means that a change is visible at this point
in the merge.  i.e. two streams need to be displayed instead of just one.

In particular, this means that an AlreadyApplied line removal will not
appear at all in the 'merge' window, but will trigger the 'diff' subwindow
to be displayed.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agovpatch: remove CHANGED
NeilBrown [Mon, 12 Nov 2012 23:05:15 +0000 (10:05 +1100)]
vpatch: remove CHANGED

The 'CHANGED' flag is unused, so discard it to avoid confusion.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agoBrowse: ensure we erase all of old type name when updating position data.
NeilBrown [Sun, 11 Nov 2012 22:25:12 +0000 (09:25 +1100)]
Browse: ensure we erase all of old type name when updating position data.

Top-right of the merge window identifies the current location in
the merge.  It is variable length and right justified, so we need to make
sure we erase start of old value before writing new value.
Old code only allowed for a difference of three which didn't cope
with, for example, change from AlreadyApplied to Changed.
So be more thorough.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agoBrowse: git problem in rendering file list.
NeilBrown [Sun, 11 Nov 2012 21:21:34 +0000 (08:21 +1100)]
Browse: git problem in rendering file list.

Now that we display the last keystroke at the very end of the
first line it is wrong to 'clrtoeol' afterwards as that will
clear the next line.

So remove that, make sure we clear the spaces before the number
incase it becomes shorter, and tidy up the display for 'ESC...' too.

Reported-by: Manpreet Singh <junkblocker@yahoo.com>
Signed-off-by: NeilBrown <neilb@suse.de>
11 years agoFreeBSD/*BSD build fixes for wiggle attached and a bug
Manpreet Singh [Sat, 6 Oct 2012 02:51:05 +0000 (19:51 -0700)]
FreeBSD/*BSD build fixes for wiggle attached and a bug

To build wiggle on FreeBSD/*BSD/Mac

 a) endian.h must be included from machine/endian.h.
 b) A small fix to dotest is needed to avoid an infinite loop.
 c) bash may not always be at /usr/bin/bash

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agoFix some new compiler warnings.
Chris Peterson [Mon, 25 Jun 2012 13:29:37 +0000 (06:29 -0700)]
Fix some new compiler warnings.

hi Neil, I pulled wiggle's latest head from git and tried to compile on Mac
OS X. I ran into some problems when I tried to compile with -O3 without
-ggdb.

gcc -Werror treated some uninitialized variable warnings as errors. Some of
the warnings look like real bugs, but many were false positives. Compiling
with -O3 and -ggdb makes all the warnings "go away." :)

I've attached a patch to fix the following valid warnings:

cc1: warnings being treated as errors
parse.c: In function `parse_patch':
parse.c:268: warning: `c' may be used uninitialized in this function

vpatch.c: In function `next_melmnt':
vpatch.c:418: warning: `e.hash' may be used uninitialized in this function

vpatch.c: In function `prev_melmnt':
vpatch.c:472: warning: `e.hash' may be used uninitialized in this function

vpatch.c: In function `draw_mside':
vpatch.c:838: warning: `tag_attr' may be used uninitialized in this function
vpatch.c:837: warning: `tag' may be used uninitialized in this function

vpatch.c:1334: warning: `e' may be used uninitialized in this function

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agovpatch - use 'cols' in main window.
NeilBrown [Thu, 17 May 2012 07:26:13 +0000 (17:26 +1000)]
vpatch - use 'cols' in main window.

We currently don't use 'cols' - which causes a warning because
it is set by an assignment inside a macro..

The trick to quiet to warning causes different warnings on other
compilers.

We could just do
   rows = getmaxy()
but that is 'legacy' so I'd rather not.

So just find somewhere to use cols..

Reported-by: "P. Martin" <mrsmiley98@lycos.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoconfig.h: include different endian file for OS/X
NeilBrown [Thu, 17 May 2012 07:20:07 +0000 (17:20 +1000)]
config.h: include different endian file for OS/X

It seems that some OS/X users don't need any endian file, and
others need machine/endian.h
Odd, but we can satisfy both, so do so.

Patch-from: "P. Martin" <mrsmiley98@lycos.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoextract: removed unused variable: lineno
NeilBrown [Thu, 17 May 2012 07:14:44 +0000 (17:14 +1000)]
extract: removed unused variable: lineno

lineno isn't used, isn't initialised, but is incremented.
So some compilers ignore it completely and others complain
that it is no initialised.

Just remove it.

Reported-by: "P. Martin" <mrsmiley98@lycos.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agomerge: make some conflicts less conflicting.
NeilBrown [Tue, 15 May 2012 12:04:03 +0000 (22:04 +1000)]
merge: make some conflicts less conflicting.

If a 'conflict' has an empty 'before' section, then it is probably
to separate things - and insertion in the original (unmatched) and
and insertion in the result.
So split it into those two, but leave the result marked as a Conflict
as the order of the insertions is not clear.

For now this mostly affects -B which can display the conflict
more effectively.

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoBrowser: fix in_conflict detection while browsing.
NeilBrown [Tue, 15 May 2012 09:31:47 +0000 (19:31 +1000)]
Browser: fix in_conflict detection while browsing.

I forget to consider 'hi' and 'lo'.

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoRelease 0.9 v0.9
Neil Brown [Mon, 14 May 2012 11:42:09 +0000 (21:42 +1000)]
Release 0.9

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoman page: add documentation for browse mode
Neil Brown [Mon, 14 May 2012 11:39:01 +0000 (21:39 +1000)]
man page: add documentation for browse mode

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoBrowser: add a bit of colour to the file-list page.
Neil Brown [Mon, 14 May 2012 01:01:13 +0000 (11:01 +1000)]
Browser: add a bit of colour to the file-list page.

Set the colour of each file depending on whether it has
conflicts or wiggles or not.

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoMerge: allow merging a multi-patch patchfile.
Neil Brown [Mon, 14 May 2012 01:01:11 +0000 (11:01 +1000)]
Merge: allow merging a multi-patch patchfile.

If
  wiggle -p -r patchfilename
is given, multiple patches - each identifying the target
file - are read from patchfilename and each is applied to the
relevant file.  Note that '-r' is required with this usage of
-p.

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agomain: only pass training args to extract/do_diff/do_merge.
Neil Brown [Sun, 13 May 2012 23:17:35 +0000 (09:17 +1000)]
main: only pass training args to extract/do_diff/do_merge.

subtract/add optind to argc/argv before passing along.  That way
sub-functions don't need to access optind directly, and it will allow
us to pass other arg strings that are independent of optind.

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoMove parse_patch and related to new parse.c
Neil Brown [Sun, 13 May 2012 23:17:32 +0000 (09:17 +1000)]
Move parse_patch and related to new parse.c

... so we can use it from wiggle.c

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoAllow load_file to load segments too.
Neil Brown [Sat, 12 May 2012 06:22:49 +0000 (16:22 +1000)]
Allow load_file to load segments too.

This will make it easier to process multi-file patches in
normal 'browse' mode.

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoMinor man-page fixes.
Neil Brown [Sat, 12 May 2012 05:59:19 +0000 (15:59 +1000)]
Minor man-page fixes.

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoImprove make clean
Neil Brown [Sat, 12 May 2012 05:38:13 +0000 (15:38 +1000)]
Improve make clean

"make clean" was leaving some generated file around.
Better remove them.

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoAdd endian.h back to config.h
Neil Brown [Sat, 12 May 2012 05:37:08 +0000 (15:37 +1000)]
Add endian.h back to config.h

It turns out we do need it after all - but only include it if we
really do need it.

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoBrowser: improve decision on when to split window for merger view.
Neil Brown [Fri, 11 May 2012 09:42:24 +0000 (19:42 +1000)]
Browser: improve decision on when to split window for merger view.

Now that we are tracking in_conflict in the broswer we "know" when
we are in a conflict and so can only display the split window then,
rather than keeping some hysteresis until we leave any changes behind.
This makes large jumps ('N' 'P') display better.
Also don't allow hunk headers to look like a 'wiggled' section, because
they aren't really.

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoBrowser: improve rendering of conflicts in the the 'merge' view.
Neil Brown [Fri, 11 May 2012 09:30:22 +0000 (19:30 +1000)]
Browser: improve rendering of conflicts in the the 'merge' view.

I was ignoring the in_conflict value, so the 'original' side
of a conflict wasn't properly displayed, and so looked confusing.

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoBrowse: don't use background colors for added/deleted.
Neil Brown [Fri, 11 May 2012 03:48:00 +0000 (13:48 +1000)]
Browse: don't use background colors for added/deleted.

Coloured backgrounds are too loud.
So for added and deleted use red and green text.

Need to find a way to highlight lone spaces..

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoBrowse: avoid display problems when changing view-mode.
Neil Brown [Fri, 11 May 2012 03:36:37 +0000 (13:36 +1000)]
Browse: avoid display problems when changing view-mode.

If we change mode so that the current end-of-line is no longer
visible, the display gets confused and add extra lines.  So when mode
changes, move backward then forward to ensure we are on a visibile
line.

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoisolate_conflicts: don't look for eol that cannot be there.
Neil Brown [Thu, 10 May 2012 07:09:52 +0000 (17:09 +1000)]
isolate_conflicts: don't look for eol that cannot be there.

When looking for 'wiggles' we need to track whole lines
in the original file.  But when looking for an end-of-line
we shouldn't look at an merge-item that doesn't even
exist in the original file.

Reported-by: Chris Peterson <cpeterso@cpeterso.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoDon't include endian.h
Neil Brown [Thu, 10 May 2012 07:03:15 +0000 (17:03 +1000)]
Don't include endian.h

It turns out it isn't needed, and OS/X doesn't have it.

Reported-by: Chris Peterson <cpeterso@cpeterso.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agobrowser: display the type of the merge-node under the cursor.
Neil Brown [Thu, 10 May 2012 06:44:10 +0000 (16:44 +1000)]
browser: display the type of the merge-node under the cursor.

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoBrowser: allow cursor to be displayed in alternate pane.
Neil Brown [Thu, 10 May 2012 06:44:10 +0000 (16:44 +1000)]
Browser: allow cursor to be displayed in alternate pane.

This allows us to navigate all of the merge.
When in the alternate pane, movement is based on visibility there.

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agobrowse/search: support selectively ignoring case.
Neil Brown [Thu, 10 May 2012 06:44:10 +0000 (16:44 +1000)]
browse/search: support selectively ignoring case.

We ignore case only if no upper chars.
Leave possiblity for explicit request for case-match later.

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agobrowse/search: don't match strings in the hunk-header.
Neil Brown [Thu, 10 May 2012 06:44:10 +0000 (16:44 +1000)]
browse/search: don't match strings in the hunk-header.

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoBrowser: Support searching-again within the same line.
Neil Brown [Thu, 10 May 2012 06:44:10 +0000 (16:44 +1000)]
Browser: Support searching-again within the same line.

This requires mcontains to know which direction we are searching in,
and whether we want a new match, or whether the old one will do.

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoBrowser: change searchdir to -1 or +1
Neil Brown [Thu, 10 May 2012 06:44:10 +0000 (16:44 +1000)]
Browser: change searchdir to -1 or +1

instead of 1 or 0.  It is less confusing that way.

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoBrowser: Extend proper cursor tracking to search.
Neil Brown [Thu, 10 May 2012 06:44:10 +0000 (16:44 +1000)]
Browser: Extend proper cursor tracking to search.

Record the cursor in search anchors so we can go back to the
right location.

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoBrowser: Use KEY_BACKSPACE to recognise a backspace.
Neil Brown [Thu, 10 May 2012 06:44:10 +0000 (16:44 +1000)]
Browser: Use KEY_BACKSPACE to recognise a backspace.

It isn't always control-H

Signed-off-by: NeilBrown <neilb@suse.de>