1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-10-24 09:38:50 +02:00
Commit graph

23 commits

Author SHA1 Message Date
epriestley
f673ab10b1 Strip colorized diffs, show line numbers in context
Summary:
  - When users pipe in colorized diffs, strip the colors instead of failing.
  - When showing context, show line numbers (we do show 3 lines around the failure, the failure was just on the first line).
  - Remove an irrelevant TODO comment (we handle this elsewhere now).

Test Plan: Unit tests.

Reviewers: Makinde, btrahan

Reviewed By: Makinde

CC: aran, epriestley

Differential Revision: https://secure.phabricator.com/D1887
2012-03-14 06:34:00 -07:00
Nick Harper
7494a95c40 [svn1.7] handle removed directories in svn in arc diff
Summary:
`svn rm $directory` removes the directory and its contents in svn 1.7, whereas
svn 1.6 only removes the directory's contents, so arc diff needs to not try
to read the directory.

Test Plan:
ran arc diff in a svn working copy that had a directory removed (with both
svn 1.6 and svn 1.7) and confirmed that the command did not throw an exception,
and that the removed directory was marked as directory (not a file).

Reviewers: epriestley, jungejason

Reviewed By: epriestley

CC: aran, epriestley

Differential Revision: https://secure.phabricator.com/D1889
2012-03-13 23:45:37 -07:00
Nick Harper
6dd511d0ef [svn1.7] Handle changes to svn properties in svn1.7 working copies
Summary: svn changed the format of property changes for svn1.7.

Test Plan: arc diff on a working copy with svn property changes

Reviewers: epriestley, jungejason

Reviewed By: epriestley

CC: aran, epriestley

Differential Revision: https://secure.phabricator.com/D1885
2012-03-13 16:34:13 -07:00
epriestley
fba87a5b6a Fix implicit fallthrough in arc
Summary: Raised by new linter.

Test Plan: Lint/inspection.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran, epriestley

Differential Revision: https://secure.phabricator.com/D1831
2012-03-09 08:57:03 -08:00
epriestley
54c3ad316e Fix arc diff / arc patch to handle files with missing trailing newlines properly
Summary:
  - When you try to "arc patch" a change which adds or removes a trailing newline or alters a file with a trailing newline near the newline, the patch fails because we fail to reconstuct the "\ No newline at end of file" line.
  - We don't currently record enough information about these diffs to reconstruct them with a sensible amount of effort. Store the "\ No newline at end of file" line instead of just a flag.
  - There are some special rules for these lines; implement them.

NOTE: This causes some display glitching in Differential, but nothing major; I'll fix that in a followup patch.

Test Plan:
  - Created a diff which added a trailing newline, removed a trailing newline, and altered a file without a trailing newline near the end of the file.
  - Verified that the git version of this patch and the 'arc export --git' version of this patch are (essentially) identical.
  - Verified that "arc diff" + "arc patch" can apply these changes.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran, epriestley

Maniphest Tasks: T533

Differential Revision: https://secure.phabricator.com/D1810
2012-03-07 13:19:58 -08:00
epriestley
8cb5292edf Parse git diffs of files with unicode characters in the names
Summary: This is probably just the first step down a long road of not handling
exotic filenames correctly, but if you diff a file named "∆.jpg" it currently
chokes while parsing the diff.

Test Plan: Added minimal failing unit test, fixed parser, test passed.

Reviewers: zeeg, btrahan

Reviewed By: btrahan

CC: aran, epriestley

Differential Revision: https://secure.phabricator.com/D1592
2012-02-08 10:04:15 -08:00
epriestley
8fe38f8b6d Finalize Arcanist Classes
Summary:
Mark all applicable Arcanist classes as "final", except PhutilLintEngine, which
needs a little finesse.

@jungejason / @nh, does this break any Facebook stuff?

Test Plan: Linter no longer raises warnings. Ran "testEverythingImplemented" in
Phabricator.

Reviewers: btrahan, jungejason, nh

Reviewed By: btrahan

CC: aran, epriestley

Maniphest Tasks: T795

Differential Revision: https://secure.phabricator.com/D1519
2012-01-31 12:07:05 -08:00
epriestley
18773682c7 Correctly parse Mercurial output for "hg diff --git" when binary files are
removed

Summary: Mercurial output diverges from git output when binary files are
removed. Parse the Mercurial flavor.

Test Plan:
  - Unit test fails before this change and passes afterward.
  - Removed a binary file in my hg local and successfully "arc diff --only"'d
the change.

NOTE: Git can't apply these patches, and reports:

  $ git apply < ~/Desktop/patch.txt
  error: removal patch leaves file contents
  error: level.png: patch does not apply

Reviewers: Makinde, btrahan, jungejason, nh, tuomaspelkonen, aran

Reviewed By: jungejason

CC: aran, jungejason, Makinde

Differential Revision: 1126
2011-11-20 14:21:40 -08:00
David Reuss
ebc2644994 Support other encodings in ArcanistDiffParser
Test Plan:
Tried viewing a diff detected as binary in diffusion with and without
setting my desired encoding. Worked as expected.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, epriestley

Differential Revision: 1008
2011-10-28 08:01:53 -07:00
epriestley
0b79132827 Refine whitespace and end-of-block detection for git binary literal patches in
mercurial changesets

Summary: Makes the parsing slightly more liberal so a test case from @Makinde
passes.

Test Plan: Ran unit tests.

Reviewers: Makinde, jungejason, nh, tuomaspelkonen, aran

Reviewed By: Makinde

CC: aran, Makinde

Differential Revision: 1054
2011-10-25 17:02:27 -07:00
epriestley
a85e344425 Improve representation of replaced symlinks in Git
Summary:
See T584. Git renders these types of changes somewhat unusually. Ensure they are
rendered as changes.

The fact that a symlink was replaced is not explicitly rendered (e.g., "This
path was changed from a symlink to a regular file."), but can be inferred from
the 'unix:filemode' property change that will accompany the changeset. We could
also make it explicit but this type of change is rare enough that it's probably
good enough as-is.

Test Plan:
  - Ran unit test, which previously failed and now passes.
  - Created a diff which replaces a file with a symlink, verified it rendered a
little more sensibly.

Reviewers: aravindn, dschleimer, jungejason, nh, tuomaspelkonen

Reviewed By: nh

CC: aran, goldshlager, nh

Differential Revision: 1030
2011-10-24 23:38:56 -07:00
epriestley
f41d6889d2 Allow Arcanist to parse "git diff --binary" and "hg diff --git" format for
changes which add or alter binary files

Summary: See test cases, derived from "hg diff --git" and "git diff --binary".

Test Plan: Test cases work now.

Reviewers: Makinde, jungejason, nh, tuomaspelkonen, aran

Reviewed By: Makinde

CC: aran, Makinde

Differential Revision: 1047
2011-10-24 23:37:29 -07:00
Marek Sapota
f67401daa4 Fix parsing of git diff when diff.mnemonicprefix=true
Test Plan:
Go to /differential/diff/create and try to upload a patch that was created with
`git diff` when diff.mnemonicprefix was set to true.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, epriestley

Differential Revision: 1022
2011-10-19 17:29:12 -07:00
epriestley
1da98a11f1 Correctly parse git diffs with an empty file at the end
Summary: A minor bug in the parser prevented it from handling git diffs where an
empty file appears at the end of the diff. Since git appends an extra newline,
we failed to jump into the '$line === null' block.

Test Plan: Ran unit tests. Generated a revision which only deleted an empty
file.

Reviewers: jungejason, nh, tuomaspelkonen, aran

Reviewed By: nh

CC: aran, nh, epriestley

Differential Revision: 998
2011-10-10 19:03:48 -07:00
epriestley
7a72b0b4f9 Be slightly less dumb about detecting "binary" files
Summary:
A better definition of "binary" is "not utf-8", instead of "has some characters
not in this arbitrary regexp". Principally, this makes files with windows
newlines not autodetect as binary.

This might fix some of the issues in T365.

Test Plan: @egillth applied this patch and verified that Diffusion now shows
file content instead of detecting everything as binary in his repo full of
Windows newlines.
Reviewed By: jungejason
Reviewers: egillth, tuomaspelkonen, jungejason, aran
CC: aran, jungejason
Differential Revision: 799
2011-08-10 13:49:06 -07:00
epriestley
268de6428c Basic Mercurial support for Arcanist
Summary:
There's a lot of ground left to cover but this makes "arc diff" work (on one
trivial diff) in my sandbox, at least, and supports parsing of Mercurial native
diffs (which are unified + a custom header). Piles of missing features, still.
Some of this is blocked by me not understanding the mercurial model well yet.

This is also a really good opportunity for cleanup (especially, reducing the
level of "instanceof" in the diff workflow), I'll try to do a bunch of that in
followup diffs.

Test Plan: Ran "arc diff" in a mercurial repository, got a diff out of it.
Reviewed By: aran
Reviewers: Makinde, jungejason, tuomaspelkonen, aran, codeblock
CC: aran, epriestley, codeblock, fratrik
Differential Revision: 792
2011-08-09 18:22:58 -07:00
epriestley
ffeeeb8c55 Allow 'arc' to parse copies or added files
Summary:
See task. This is a bizarre edge case which we incorrectly reject but should do
our best with.

Test Plan:
Created an added copy of a file and diffed it successfully.

Reviewed By: alex
Reviewers: alex, jungejason, tuomaspelkonen, aran
CC: aran, alex
Differential Revision: 547
2011-06-29 13:13:06 -07:00
epriestley
4bce8732e5 Expand ArcanistDiffParser to accept awkward Diffusion + SVN workflows. 2011-03-30 19:33:50 -07:00
epriestley
5099b005cf Some documentation.
Summary:

Test Plan:

Reviewers:

CC:
2011-02-19 11:36:08 -08:00
epriestley
6082b89eb4 Use the '(?P<' syntax instead of '(?<' for capturing named subgroups. 2011-02-09 09:12:21 -08:00
epriestley
964630facc Integrate with file.upload over conduit to ship binary changes to Differential.
Summary: support binary upload in the new arc so we can show image diffs, e.g.

Test Plan:

Reviewers:

CC:
2011-01-11 15:39:40 -08:00
epriestley
f071a55266 Avoid path change collision issue when diffing an unusual edge case out of
svn.

Summary: when you "svn cp" with a revision, we end up with some path collision
problems. This isn't a complete fix but it gets the change to Differential,
at least.

Test Plan:

Reviewers:

CC:
2011-01-10 12:41:58 -08:00
epriestley
2e73916fa2 Initial commit. 2011-01-09 15:22:25 -08:00