Commit Graph

1765 Commits

Author SHA1 Message Date
Dan Davison
040ad76741
Fix grep parse bugs (#865)
Evolve grep output parsing heuristics

* Demand a non-space before extension

* New grep parse heuristic

If something like any of the following are seen then that is assumed
to be a file name with an extension followed by a line number. I.e. we
do not support file names with such patterns internally.

.xx-7-
.xx=7=
.xx:7:
2022-01-05 16:51:00 -05:00
Thomas Otto
48fec2e6fd Make Config cloneable for DeltaTest, store as Cow<Config> there
Only cloneable when testing, the types git2::Config and
git2::Repository in GitConfig contain C pointers and can't
really be cloned.
2022-01-04 19:51:23 -05:00
Wayne Davison
1d6f18a663
DeltaTest improvements (#876)
* DeltaTest improvements

- Added .expect_contains(), .expect_raw_contains(), and
  .expect_contains_once() member functions to DeltaTestOutput.
  These functions also output some helpful debug info when the
  assert fails.
- Separated .with_config_and_input() into .with_config() and (the
  tweaked) .with_input().
- Made .with_config() create a DeltaTest object (like .with() does).
- Renamed .with() as .with_args().
- Moved .explain_ansi() from DeltaTestOutput to DeltaTest, which must
  now be called prior to .with_input() since the latter stashes off both
  the raw_output & the processed output in the object.
- Changed .expect() and .expect_skip() to return Self so that they can
  continue a chain of multiple expect calls (e.g. a series of partial
  matches with different skip values).
- The processed output text can be accessed via `test_obj.output` (see
  also `test_obj.raw_output`).
- Renamed .expect_skip() to .expect_after_skip().
- Changed .expect() to start at the first line.
- Added .expect_after_header() that works like the old .expect().
- Renamed lines_match() to assert_lines_match() and made it match all
  lines (no skip number).
- Added assert_lines_match_after_skip() to work like the old
  lines_match() function, but with the .expect_after_skip() arg order.
- Converted some old-style tests into DeltaTest style tests.
- Renamed set_cfg as set_config
2022-01-04 03:39:03 -05:00
Dan Davison
cd47b21176 Decrease size of Amazon delta image 2022-01-03 20:16:29 -05:00
Thomas Otto
59604a376f Cache parent process when testing unless FakeParentArgs are used 2022-01-03 17:28:27 -05:00
Thomas Otto
c1392d6e1c The calling process must have a common parent with delta
Ensures that no unrelated process is found when selectively
refreshing a pid range.
2022-01-03 17:28:27 -05:00
Thomas Otto
3a3f597704 Move parent process query into a thread
Start the query even before determining if information about the
parent process is required (which are most invocations anyhow).
2022-01-03 17:28:27 -05:00
Thomas Otto
15d7bb8cf0 Re-enable full process scans on Linux 2022-01-03 17:28:27 -05:00
Thomas Otto
8f2a8ce496 Disable /proc fd caching on Linux when querying processes
This query only happens once, so caching is not needed

Also update sysinfo version to fix a crash related to this.
2022-01-03 17:28:27 -05:00
Wayne Davison
50ece4b0cc Put file-modified label in front of mode changes.
When using `--navigate` with files that get their mode modified, the
file-modified label was not being prefixed, so these changes were not
being marked as skip destinations.  This is particularly bad if a file
has line changes along with the mode change AND the user has an empty
hunk label (since that would make the entire file's changes get skipped
with an "n").

I added a test of a mode-change with a line-change, and a test for a
mode change where the old & new mode values are not one of the two
expected value-pairs.  I also used format_file() on the mode filenames
since the other format() calls were using it.
2022-01-01 08:29:25 +00:00
Dan Davison
13f60da9ff Use formatted blame metadata as blame key
Fixes #868
2021-12-28 12:16:43 +00:00
Dan Davison
62ca45953f blame-separator and blame-separator-style options 2021-12-28 12:16:43 +00:00
Dan Davison
76905c8e87 Refactor blame handler
- Give up on repeat blame line optimization
- Don't assume blame key is commit
2021-12-28 12:16:43 +00:00
Dan Davison
97747ddb43 Remove space from blame-format 2021-12-24 07:40:45 -05:00
Dan Davison
a1b8dbc410 New option blame-code-style
Fixes #867
2021-12-24 07:40:45 -05:00
Dan Davison
67124941d5 Tweak issue template 2021-12-22 12:23:09 -05:00
Dan Davison
31481db596 Tweak issue template 2021-12-22 12:04:21 -05:00
dependabot[bot]
990dca2675
Bump sysinfo from 0.22.2 to 0.22.3 (#862)
Bumps [sysinfo](https://github.com/GuillaumeGomez/sysinfo) from 0.22.2 to 0.22.3.
- [Release notes](https://github.com/GuillaumeGomez/sysinfo/releases)
- [Changelog](https://github.com/GuillaumeGomez/sysinfo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/GuillaumeGomez/sysinfo/commits)

---
updated-dependencies:
- dependency-name: sysinfo
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-12-20 18:13:33 -05:00
庄天翼
d71da62d49
Remove redundent spaces in README example (#861) 2021-12-19 23:26:17 -05:00
Dan Davison
ab54c116ec Update --help text 2021-12-15 19:03:29 -05:00
Dan Davison
0bf10022ad Bump version in docs 2021-12-15 18:56:15 -05:00
Dan Davison
1458879231 Bump version 2021-12-15 18:49:51 -05:00
Dan Davison
b8c93f3f07 Update sysinfo to released version
Ref #839
2021-12-15 18:44:30 -05:00
Dan Davison
b5d7c23e07
Line state refactor (#851)
* Refactor: compute raw line and new line state
2021-12-14 22:21:07 -05:00
Dan Davison
d72ddfc6ad Delete calls printing output in tests 2021-12-14 01:39:48 -05:00
Dan Davison
2dad3e8060 Add inspect_raw method to DeltaTest 2021-12-14 01:39:48 -05:00
Dan Davison
f650f485ed Add markers surrounding DeltaTest::inspect() output 2021-12-14 01:39:48 -05:00
Dan Davison
799ad15d15 Don't take syntax-theme from env var during tests
Fixes #842
2021-12-14 01:39:39 -05:00
Dan Davison
cec8542e5f Revert "Ignore test maing ANSI assertions"
This reverts commit 424fe8b59a.
2021-12-14 01:39:39 -05:00
Dan Davison
8b408cc57f Clean up DeltaTest argument 2021-12-13 23:21:31 -05:00
Dan Davison
bc8676dd4d Add Test for #753 3ce64ddefb 2021-12-13 23:21:31 -05:00
Dan Davison
cf270eefd9 Bug fix: emit merge conflict markers even when width=variable 2021-12-13 17:45:35 -05:00
Dan Davison
3ce64ddefb Emit line as raw if canonical line state is raw
Fixes #753
2021-12-12 23:34:34 -05:00
Dan Davison
1767b3be29 Refactor: make state available when determining whether line should be emitted raw 2021-12-12 23:34:34 -05:00
Dan Davison
fbf88e4686 DELTA_FEATURES appends iff prefixed with +
Thanks @bew for the suggestion.

Fixes #848
2021-12-12 17:36:56 -05:00
Dan Davison
ab278a77fb Avoid using environment variables during tests 2021-12-12 17:36:56 -05:00
Dan Davison
b995bd4ea0 Add @Wilfred's difftastic to Similar Projects section of README 2021-12-12 12:51:21 -05:00
Dan Davison
f88f0a4eda Fix tests: don't access lazy_static in tests 2021-12-12 00:20:52 -05:00
Dan Davison
9d1b25ac43 Disable line numbers and side-by-side under --word-diff
We currently have no way of computing correct line numbers: it seems that we would need to identify
wholly added and removed lines from the ANSI color sequences. side-by-side is (I imagine) almost
always used with line numbers, and it doesn't make much sense for word-diff anyway.
2021-12-12 00:20:52 -05:00
Dan Davison
c1d8867f80 Raw pass-through handling of --word-diff and --color-words output
The previous implementation (5895cfa) was incorrect.

Fixes #829
2021-12-12 00:20:52 -05:00
Dan Davison
34b99407a7 Failed attempt to add a test of --map-styles with --color-words 2021-12-12 00:20:52 -05:00
Dan Davison
15e9374b78 Allow calling process to be specified in DeltaTest builder methods 2021-12-12 00:20:52 -05:00
Dan Davison
b732c9419e Add failing tests of --word-diff and --color-words 2021-12-12 00:20:52 -05:00
Dan Davison
081e0a7c66 Refactor: factor out a helper function in DeltaTest 2021-12-12 00:20:52 -05:00
Dan Davison
8dfd22ba8a Fix specification of git revision in Cargo.toml dependency
Ref #845
2021-12-11 16:58:21 -05:00
Dan Davison
69c7aaa28f
Do not query CPU data when querying process data (#845)
* Do not query CPU data when querying process data

Fixes #839
Ref https://github.com/GuillaumeGomez/sysinfo/issues/632

* Update branch of sysinfo

* Update upstream sysinfo commit

Ref https://github.com/GuillaumeGomez/sysinfo/pull/636

* Point sysinfo at an explicit commit rather than a symbolic branch name

commit d647acfbf216848a8237e1f9251b2c48860a547f
Merge: 989ac6c 67a586c
Author: Guillaume Gomez <guillaume1.gomez@gmail.com>
Date:   2 hours ago

    Merge pull request #636 from GuillaumeGomez/update-if-needed

    Only update processors if needed
2021-12-11 15:31:34 -05:00
Thomas Otto
5c1612ec0a Query fewer processes when searching for the parent
This query now happens for more invocation types, so speed it up.
Call `refresh_process()` only on pids numerically close to the one
of delta itself.
2021-12-11 15:14:41 -05:00
Rashil Gandhi
87156fb871
Store history file in data_local_dir for Windows (#847)
* Store history file in data_local_dir

* Be specific
2021-12-11 14:19:43 -05:00
Dan Davison
da083bba2a Store raw_line in HunkZero, as HunkMinus and HunkPlus
ref #829
2021-12-09 20:46:28 -05:00
Dan Davison
9554f47ce9 Refactor
Ref #829
2021-12-09 20:46:28 -05:00