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

229 commits

Author SHA1 Message Date
Joshua Spence
b1112e73c4 Minor linter fixes
Summary: Apply some linter autofixes.

Test Plan: `arc lint` and `arc unit`

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D10568
2014-09-27 10:21:23 +10:00
Bob Trahan
ec948a276d Arcanist - potentially fix some Windows badness
Summary: Fixes T5914, maybs.

Test Plan: will ask users in T5914

Reviewers: chad, epriestley

Reviewed By: chad, epriestley

Subscribers: chad, bluehawk, epriestley, Korvin

Maniphest Tasks: T5914

Differential Revision: https://secure.phabricator.com/D10333
2014-08-21 16:07:00 -07:00
epriestley
377eb5d1e0 Don't interpret arc browse . as a commit
Summary: Ref T5781. `git show .` works like HEAD, but that isn't what `arc browse .` means.

Test Plan: Ran `arc browse .` with a repository at a published commit.

Reviewers: chad, btrahan, avive, avivey

Reviewed By: avivey

Subscribers: epriestley, avivey

Maniphest Tasks: T5781

Differential Revision: https://secure.phabricator.com/D10197
2014-08-08 11:21:43 -07:00
epriestley
26b71baf09 Allow "arc browse <symbol>" to resolve symbolic commits
Summary: Ref T5781. This makes things like `arc browse master` work (but they open the commit, not a revision).

Test Plan: Ran `arc browse master`.

Reviewers: csilvers, btrahan

Reviewed By: btrahan

Subscribers: epriestley, spicyj

Maniphest Tasks: T5781

Differential Revision: https://secure.phabricator.com/D10143
2014-08-04 12:03:22 -07:00
Evan Priestley
97501da164 Fix double file content in files in new subdirectories in Subversion
Summary:
Fixes T5555. Normally, when we `svn diff subdir/`, we use `--depth empty` to get only changes for the directory itself (usually, property changes).

However, this flag has no effect if the directory is newly added.

Adjust the diff parser so that if two sets of hunks are specified for a single file in a raw diff, we let the last one win instead of including both. This approach is a broadly more reasonable interpretation of these diffs.

Test Plan:
  - Added a new file in a new subdirectory in Subversion.
  - Ran `arc diff --only`.
  - No double file content in resulting diff.
  - Added unit test.
  - There's fairly comprehensive unit test coverage for this stuff.

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley

Maniphest Tasks: T5555

Differential Revision: https://secure.phabricator.com/D9921
2014-07-15 09:43:04 -07:00
Joshua Spence
9016207307 Fix various spelling mistakes
Summary: Minor change, self-explanatory.

Test Plan: Eye-ball it.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9910
2014-07-13 00:45:38 +10:00
epriestley
f9f2092246 Use git diff a b for ranges, not git diff a..b
Summary:
These are documented as being identical, but `git diff a b` works if `a` is a tree (for example, `4b825d...`, the empty tree hash), but `git diff a..b` does not.

Particularly, with the `a..b` form, `arc diff --base arc:empty` does not work. With the `a b` form, it does.

Test Plan: Ran `arc diff --base arc:empty` in a repository and got a diff.

Reviewers: btrahan, talshiri

Reviewed By: talshiri

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D9898
2014-07-11 10:45:11 -07:00
epriestley
0be983a7a3 Parameterize @{upstream} in arc to fix Windows
Summary: We manually quote this in a couple of places. That works fine on Lunix, but does not work on Windows. Instead, explicitly parameterize the command so the correct quoting rules are applied for the OS.

Test Plan: See IRC; windows user had issues fixed by this. `arc:upstream` still works locally.

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D9868
2014-07-10 07:56:35 -07:00
Joshua Spence
d09beeb75c Remove @group annotations
Summary: I'm pretty sure that `@group` annotations are useless now... I believe that they were originally used by Diviner?

Test Plan: Eye-balled it.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin, aurelijus

Differential Revision: https://secure.phabricator.com/D9855
2014-07-09 09:12:13 +10:00
Richard van Velzen
792204db95 Refactor author handling in the Mercurial API
Summary: There were two callsites which needed some information from the username. Only one worked "correctly", causing `arc diff` to not amend commits anymore because the author could not be parser.

Test Plan: run `arc diff` with changes

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9797
2014-07-02 13:59:25 -07:00
epriestley
dd1f93d77b Fix race condition inside git diff-files
Summary:
There's some sort of race inside `git` here, where the `git diff-files` command exits with different results some of the time when run in parallel with `git ls-files` or `git diff` (running either command was sufficient to trigger the race).

Run it separately to avoid the race.

I poked around the `git` source a little bit but quickly lost interest given that the issue seems fixed and this workaround is essentially reasonable.

Test Plan: Ran test 20x in a row without failures.

Reviewers: hach-que

Reviewed By: hach-que

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D9616
2014-06-18 05:33:05 -07:00
Richard van Velzen
680ec3670c Don't parse mercurial usernames without email address as an email address
Summary:
This leads to information being lost when others do `arc patch` because the name is used as the email address.

For example:
  username = Richard van Velzen

Would give:
  'authorName' => null,
  'authorEmail' => 'Richard van Velzen'

Test Plan:
ran it through my head a couple of times, and tested it with the common options which all gave the expected result:
  'rvanvelzen@company.com',
  'Richard van Velzen',
  'Richard van Velzen <rvanvelzen@company.com>',
  'Richard van Velzen rvanvelzen@company.com',

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9605
2014-06-17 11:46:49 -07:00
Richard van Velzen
3201239e85 Correctly recognize "no bookmarks" for Mercurial
Summary: Fixes T5086.

Test Plan: remove all bookmarks and run `arc feature`

Reviewers: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Maniphest Tasks: T5086

Differential Revision: https://secure.phabricator.com/D9588
2014-06-17 04:51:55 -07:00
epriestley
dfe2bde88d Dirty cache of HEAD commit after an amend/range reload
Summary:
Introducing `--head` caused us to run `git diff base..head` explicitly.

However, we can now hit this workflow:

  - We resolve `HEAD` as commit `aaaa1`.
  - This is cached.
  - We notice dirty working copy changes and prompt the user to amend them to HEAD.
  - The user accepts the amend.
  - We amend, creating commit `bbbb2`.
  - We dirty the commit range and reload the working copy. This //does not// dirty the cache of HEAD.
  - We run `git diff`, but it uses the old cached HEAD: `git diff base..aaaa1`.
  - This works fine (`aaaa1` still exists, it's just not on any branch) but produces the wrong diff (without amended changes).

To resolve this, implement the "dirty the cache when the range reloads" hook.

Also never try to amend if the user provides `--head`.

Test Plan:
Ran `arc diff --only --trace` in a working copy with a new commit and some uncommitted changes.

  - Prior to this change, saw a `git diff base..aaaa1` command and the wrong diff.
  - After this change, saw a `git diff base..bbbb2` command and the correct diff.

Reviewers: chad, csilvers, talshiri

Reviewed By: talshiri

Subscribers: epriestley, spicyj

Differential Revision: https://secure.phabricator.com/D9506
2014-06-12 15:46:15 -07:00
epriestley
9492b4ecba Tweak error and status messages for commit ranges
Summary: Improve/clarify some error messages a bit, hopefully.

Test Plan: Ran `arc which`, `arc diff`, etc., with various explicit, implicit, and `--head` flags. Read error messages, didn't catch anything too awkward.

Reviewers: talshiri

Reviewed By: talshiri

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D9489
2014-06-11 16:35:50 -07:00
Tal Shiri
6b192f3178 --range support for git
Summary:
This adds support for passing range of commits for arc diff. This is useful when you want to submit code reviews for past commits without mucking around with the working copy.

This will probably require changes :)

Test Plan: Tested locally, but totally need to add tests for this

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9369
2014-06-11 14:37:01 -07:00
Joshua Spence
ff1915ecff Apply various linter fixes.
Summary: Applied various linter fixes. Also make the `.editorconfig` file a bit more specific. Unfortunately, `arc lint --apply-patches` currently modifies some test data that it shouldn't, but this should be fixed after T5105.

Test Plan: Ran `arc unit` to make sure things weren't broken.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin, aurelijus

Differential Revision: https://secure.phabricator.com/D9440
2014-06-10 11:02:42 -07:00
Richard van Velzen
b60eaa6487 Make retrieving parents for mercurial commits work consistently across platforms
Summary:
Currently the template is single quoted, but Windows only supports double quotes. This meant that the output would be like:
  lang=text
  'aabbccddeeffaabbccddeeffaabbccddeeff0123
  '

Which is clearly wrong.

This is displayed like that in Phabricator as well, which is confusing.

Test Plan: ran `arc diff` on a Windows machine and saw the correct behaviour.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9450
2014-06-10 10:20:39 -07:00
Joshua Spence
17820442da Change double quotes to single quotes.
Summary: Ran `arc lint --apply-patches --everything` over rARC, mainly to change double quotes to single quotes where appropriate. These changes also validate that the `ArcanistXHPASTLinter::LINT_DOUBLE_QUOTE` rule is working as expected.

Test Plan: Eyeballed //most// of the diff.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin, aurelijus

Differential Revision: https://secure.phabricator.com/D9269
2014-05-23 13:53:05 -07:00
Joshua Spence
a2706f6539 Ignore detached git branches.
Summary:
Fixes T4559.

It looks like the code currently (at least partially) handles this by checking for `(no branch)`. I suspect that the behaviour of `git` has changed (I am running version 1.9.0) because I haven't figured out what state to be in to cause `git` to output `(no branch)`.

Test Plan: Ran `arc branch` when on a detached branch.

Reviewers: #blessed_reviewers, epriestley

CC: Korvin, epriestley, aran

Maniphest Tasks: T4559

Differential Revision: https://secure.phabricator.com/D8466
2014-03-09 08:04:33 -07:00
Richard van Velzen
114bb9f25b Align usages of "\1" and "\2" in MercurialRepositoryAPI
Summary:
Especially on Windows it is hard to use "\1" type escapes in shell commands. The direct usage resulted in some undefined variables because the \1 and \2 weren't actually passed as control characters.

By passing them through the regular arguments list they get sent in the "correct way" regardless of OS

Test Plan: Executed `arc diff` in a HG repo and did not get undefined indexes back

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley

CC: Korvin, epriestley, aran

Differential Revision: https://secure.phabricator.com/D8129
2014-02-02 08:26:25 -08:00
epriestley
d1a68ccb37 Don't consider a no-op amend to be an error in Mercurial
Summary:
Unlike git, Mercurial considers an `hg commit --amend` which doesn't change the working copy to be an error.

The current behavior for this is fairly bad, since the user gets an exception wrapping the entire command ("Command Failed! ...") and it's pretty verbose and not obvious what has happened.

Some alternatives are:

  1. Detect this condition and raise a more tailored exception, like a UsageException.
  2. Detect this condition and succeed.

Although I tend to think (1) is the right approach in general (that is, `arc x` should usually behave like `git x` or `hg x`), I went with (2) here because we have a handful of amend callsites and they all assume git semantics (no-op amends are successful), and because I think Mercurial's behavior is a little silly (the working copy ends up in the correct / expected state, which seems fairly clearly like a success to me).

Test Plan:
  - Had reporting user verify patch.
  - Ran `arc amend --revision Dxxx` twice in a Mercurial working copy.

The old output looked like this:

  $ arc amend --revision 922
  Amending commit message to reflect revision D922: Improve performance of PhutilSymbolLoader::selectAndLoadSymbols().
  Exception
  Command failed with error #1!
  COMMAND
  HGPLAIN=1 hg commit --amend -l '/private/var/folders/8k/c3vkmjy5335gcxdzxkhwq82w0000gn/T/71k8q057844c4g84/3539-gfkvV4'

  STDOUT
  nothing changed

  STDERR
  (empty)
  (Run with --trace for a full exception trace.)

The new output looks like this:

  $ arc amend --revision 922
  Amending commit message to reflect revision D922: Improve performance of PhutilSymbolLoader::selectAndLoadSymbols().
  Done.

Reviewers: btrahan, richardvanvelzen

Reviewed By: richardvanvelzen

CC: aran

Differential Revision: https://secure.phabricator.com/D8083
2014-01-28 03:03:30 -08:00
epriestley
1daa719ace Don't choke on blame of files with whitespace-only trailing lines
Summary:
Fixes T4349. Two issues:

  - As discussed in T4349, we would trim the entire output and then require spaces when matching. This choked incorrectly if the last line of a file contained only whitespace. Use `phutil_split_lines()` instead, and regexp things more reasonably.
  - We were capturing the line text, not the commit, as "revision". This isn't actually used elsewhere, but was obviously wrong. Make this consistent with Git/SVN.

Test Plan: Rigged a call up and saw reasonable output after the patch, on a working copy which threw before the patch.

Reviewers: durham, btrahan

Reviewed By: durham

CC: aran

Maniphest Tasks: T4349

Differential Revision: https://secure.phabricator.com/D8078
2014-01-27 11:03:08 -08:00
epriestley
a7376624b4 Allow arc to identify repositories without "project_id"
Summary:
Ref T4343. Continues the process of reducing the prominence of Arcanist Projects. Primarily:

  - Query Phabricator to identify the working copy based on explicit configuration, or guess based on heuristics.
  - Enhance `arc which` to explain the process to the user.
  - The `project_id` key is no longer required in `.arcconfig`.

Minor/cleanup changes:

  - Rename `project_id` to `project.name` (consistency, clarity).
  - Rename `conduit_uri` to `phabricator.uri` (consistency, clairty).
  - These both need documentation updates.
  - Add `repository.callsign` to explicitly bind to a repository.
  - Updated `.arcconfig` for the new values.
  - Fix a unit test which broke a while ago when we fixed a rare definition of "unstaged".
  - Make `getRepositoryUUID()` generic so we can get rid of one `instanceof`.

Test Plan:
  - Ran `arc which`.
  - Ran `arc diff`.
  - This doesn't really change anything, so the only real risk is version compatibility breaks. This //does// introduce such a break, but the window is very narrow: if you upgrade `arc` after this commit, and try to diff against a Phabricator which was updated after yesterday (D8068) but before D8072 lands, the lookup will work so we'll add `repositoryPHID` to the `differential.creatediff` call, but it won't exist in Phabricator yet. This window is so narrow that I'm not going to try to fix it, as I'd guess there is a significant chance that no users will be affected. I don't see a clever way to fix it that doesn't involve a lot of work, either.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T4343

Differential Revision: https://secure.phabricator.com/D8073
2014-01-26 15:31:30 -08:00
epriestley
488b8e365a In Subversion, treat missing files similarly to conflicted files
Summary: See <https://github.com/facebook/arcanist/issues/133>. Treat "!" files like "C" and "?" files and make the user deal with them.

Test Plan:
  >>> orbital ~/repos/INIS $ svn st
  !       README
  >>> orbital ~/repos/INIS $ arc diff
  Usage Exception: You have missing files in this working copy. Revert or formally remove them (with `svn rm`) before proceeding.

    Working copy: /INSECURE/repos/INIS/

    Missing files in working copy:
      README

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Differential Revision: https://secure.phabricator.com/D7886
2014-01-03 12:23:34 -08:00
epriestley
4fdb87761b Fix working copy binding powers in weird edge cases
Summary:
Fixes T1277. The rules we use to figure out the root of the working copy get a bunch of edge cases wrong right now. A particularly troublesome one is when a user has a `/.arcconfig` or `/home/.arcconfig` or similar, which raises a completely useless and confusing error message (T1277).

Rewrite these rules to get all the edge cases correct and do reasonable things in the presence of stray `.arcconfig`. There are a bunch of comments, but basically the algorithm is:

  - From the top, go down one directory at a time until we find ".svn", ".git", or ".hg".
  - In Subversion, keep going down looking for ".arcconfig". In Git and Mercurial, look for ".arcconfig" only in the same directory.
  - Now that we've figured out the VCS root (where the ".vcs" directory is) and the project root (where the ".arcconfig" file is, if it exists), build an identity.

This logic was also spread across three different places. Consolidate it into one and add some logging so we can figure out what's going wrong if users run into trouble.

Test Plan:
  - Ran VCS (`arc list`) and non-VCS (`arc help`) commands in Git, Mercurial, and Subversions roots and subdirectories. Also ran them in non-VCS directories. Ran them with and without .arcconfig. All the outputs seemed completely reasonable.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T1277

Differential Revision: https://secure.phabricator.com/D7686
2013-12-03 10:32:31 -08:00
Ramkumar Ramachandra
6033f14221 ArcanistGitAPI: replace 'ls-files -m' with diff-files
As documented,

  $ git ls-files -m

fails to exclude ignored submodules. Replace it with an equivalent:

  $ git diff-files --name-only

which does not suffer from this defect.

See: <https://github.com/facebook/arcanist/pull/121>

Reviewed by: epriestley
2013-11-22 08:39:20 -08:00
Ramkumar Ramachandra
e62b23e67d ArcanistGitAPI: document a git ls-files bug
When a submodule is ignored (ignore=all in .gitconfig),

  $ git ls-files -m

fails to exclude the submodule from the listing. Other commands like

  $ git diff-index --name-only HEAD

exclude it just fine.

See: <https://github.com/facebook/arcanist/pull/120>

Reviewed by: epriestley
2013-11-22 05:35:37 -08:00
Ramkumar Ramachandra
86eae809e0 ArcanistGitAPI: remove a bogus comment
See: <628de7d7a1 (commitcomment-4675543)>

This comment is indecipherable even if it originally meant something.

Reviewed by: epriestley
2013-11-22 05:28:37 -08:00
epriestley
9310df9615 Handle empty output from hg --debug branches in the parser
Summary: Ref T1493. Also consolidate this a bit more.

Test Plan: Unit tests.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T1493

Differential Revision: https://secure.phabricator.com/D7481
2013-11-04 12:15:12 -08:00
Aviv Eyal
0d212ccf5a rename getConfig -> getProjectConfig, make all linters use getConfigFromAnySource
Summary:
Lingers on from D7271; Rename `ArcanistWorkingCopyIdentity.getConfig()`.

Changed all linters (Except one) to use `getConfigFromAnySource()`, because it seems to make sense.

Test Plan: arc unit --everything; arc lint in github.com:epriestley/arclint-examples.git (Except for phpcs, flake8, cpplint and csslint which I don't have installed).

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley

CC: chad, Korvin, epriestley, aran

Differential Revision: https://secure.phabricator.com/D7382
2013-10-22 15:34:06 -07:00
epriestley
2c64f1b072 Minor, fix a missing config source change. 2013-10-19 13:32:59 -07:00
Aviv Eyal
a2285b2b5a Extract configuration read/write methods out of BaseWorlkflow
Summary:
Create a new class for them, pass instance around as need.

This looks like it's mostly working, but I'd like to replace the various `new ArcanistConfigurationManager()`
calls with something more suitable.

And maybe get a better name for ArcanistConfigurationManager ("Configuration" is already taken).

Test Plan: arc unit --everything, and then some.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley

CC: Korvin, epriestley, aran, chad

Differential Revision: https://secure.phabricator.com/D7271
2013-10-18 16:10:45 -07:00
root
10a9bb1e99 Keep Arcanist from mistaking paths that look like svn:externals as svn:externals
Summary: Fixes T3920. Added a slash to the path and external name so that "public" and "publicnotexternal" won't appear to be the same root.

Test Plan:
We've had this issue in one of our projects for some time, just ran into it again today. Ran the patched arc against the same directory structure and the troublesome file was added to the diff. Confirmed that files
modified in the "public" (svn external) folder are still caught as external modifications.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T3920

Differential Revision: https://secure.phabricator.com/D7226
2013-10-04 17:31:18 -07:00
epriestley
ba3c8e3356 Ignore errors from "svn upgrade" in unit tests
Summary: See discussion in D6893. Different versions of `svn` do different stuff, just ignore any possible error here.

Test Plan: Ran unit tests.

Reviewers: andrewjcg, btrahan

Reviewed By: andrewjcg

CC: aran

Differential Revision: https://secure.phabricator.com/D6946
2013-09-11 21:23:30 -07:00
Aviv Eyal
1fa8e861b2 parse ls-tree with git-submodule correctly
Summary:
git ls-tree gives type 'commit' for submodules.

This code-path is only used when a binary file is present in the diff.

Test Plan: arc diff with a binary file

Reviewers: epriestley

Reviewed By: epriestley

CC: Korvin, aran

Differential Revision: https://secure.phabricator.com/D6943
2013-09-11 10:36:23 -07:00
epriestley
5b869c2349 Fix arc + svn + delted binary file with properties + image heuristic
Summary:
See IRC. This fixes an issue when deleting an SVN file that ends with one of the extensions in the regexp, which may only affect newer versions of SVN.

Possibly we shouldn't have this heuristic, or should move it elsewhere or make it more explicit, but at least stop it from being broken for now.

Test Plan: Ran `arc diff --only` in a working copy with a deleted binary file ending in ".jpg".

Reviewers: btrahan, nh

Reviewed By: nh

CC: aran, mbishopim3

Differential Revision: https://secure.phabricator.com/D6893
2013-09-05 15:05:26 -07:00
durham
57bc582ad2 Better heuristic for checking for hgsubversion
Summary:
The existing heuristic checks for the existence of .hg/svn, but it
turns out that this directory can exist in a non-svn hg repo if the user or a
script ever runs a 'hg svn' command.

Now we check for a file inside .hg/svn.  The hgsubversion maintainer said this
particular file will always be present in hgsubversion repos.

Test Plan:
arc land --trace
Verified it used 'hg push' and not 'hg push -r ...'. This indicates it
considered the repo to be an hgsubversion repo.

Reviewers: epriestley

Reviewed By: epriestley

CC: dschleimer, sid0, Korvin, aran

Differential Revision: https://secure.phabricator.com/D6807
2013-08-23 16:40:15 -07:00
durham
8465c4dd53 Fix arc land for mercurial on windows
Summary:
arc for mercurial on windows was broken in several way.
Executing a command via passthru failed because passthru on windows
skips the shell so 'set HGPLAIN=1 & ...' was an invalid command. The
fix was to just not set HGPLAIN for passthru commands on windows.

Also removed hardcoded '' quotes in mercurial commands since windows
doesn't support single quots.

Test Plan: arc land --hold on a windows machine

Reviewers: epriestley

Reviewed By: epriestley

CC: Korvin, aran

Differential Revision: https://secure.phabricator.com/D6763
2013-08-14 18:00:51 -07:00
Eric Stern
dccc8571d7 Improve arc commit with SVN branches
Summary:
If you are trying to commit someone else's diff, arc commit gives warnings about path mismatch. This changes the path comparison to be based on the repo url rather than the local working directory. E.g. if both the author and committer are working in branches/release/2013_08_07 despite being checked out in ~/dev/2013_08_07 (system user being different, of course) it no longer warns that the WC path is different

Original behavior:

	eric@Eric-MBP ~/dev/2013_07_31: arc commit --revision 21
		You are not the author of 'D21: WeMerge Automatic Request'. Commit this
		revision anyway? [y/N] y

		Revision 'D21: WeMerge Automatic Request' was generated from '', but
		current working copy root is '/Users/eric/dev/2013_07_31/'. Commit this
		revision anyway? [y/N] y

	Committing 'D21: WeMerge Automatic Request'...
	Adding         test
	Transmitting file data .
	Committed revision 52676.
	Closing revision D21 'WeMerge Automatic Request'...
	Exception
	ERR-CONDUIT-CORE: You can not mark a revision you don't own as closed.
	(Run with --trace for a full exception trace.)

New behavior:

	eric@Eric-MBP ~/dev/2013_07_31: arc commit --revision 24

		You are not the author of 'D24: WeMerge Automatic Request'. Commit this
		revision anyway? [y/N] y

	Committing 'D24: WeMerge Automatic Request'...
	Adding         test
	Transmitting file data .
	Committed revision 52679.
	Closing revision D24 'WeMerge Automatic Request'...
	Exception
	ERR-CONDUIT-CORE: You can not mark a revision you don't own as closed.
	(Run with --trace for a full exception trace.)

Test Plan: 'arc diff' changes with one user. 'arc patch Dxx' on a different working copy by a different user to review and test changes. accept review. 'arc commit --revision xx' as reviewer to land the patch. complaint goes away.

Reviewers: epriestley, ghostwriter78

Reviewed By: epriestley

CC: aran, epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D6665
2013-08-04 09:01:22 -07:00
epriestley
ae66d4caa9 Use a temporary file to execute arc patch
Summary:
Piping data around on Windows doesn't work well when it contains zany characters like "null" and "newline". Fixes T3266.

Instead of piping data into `git apply`, write to a temporary file.

Test Plan:
Ran `arc patch`, got good results.

  >>> [17] <exec> $ git apply --index --reject -- '/private/var/folders/8k/c3vkmjy5335gcxdzxkhwq82w0000gn/T/7z9iea6srikoo0sc/4266-ZEyvz9'

Reviewers: btrahan, hach-que

Reviewed By: hach-que

CC: aran

Maniphest Tasks: T3266

Differential Revision: https://secure.phabricator.com/D6070
2013-05-30 21:03:21 -07:00
epriestley
592172c775 Remove "--allow-empty-message"
Summary: @alex has git 1.7.0.4 which doesn't have this flag. We don't actually need it: we always provide a commit message when calling this method. Remove the flag for compatibility, leaving a note in case we bump into this in the future.

Test Plan: N/A

Reviewers: btrahan, vrana, alex

Reviewed By: alex

CC: aran

Differential Revision: https://secure.phabricator.com/D5926
2013-05-14 13:35:42 -07:00
Howard Chan
3116d3656a Adding arc revert command[]
Summary:
Arc Revert does the following:
1. Git revert
2. Go to the differential of the rev you are reverting and either repoen it or set it to a reverted state
3. File a hipri task to orig author

[Preview] Creating Arc Revert workflow

Porting arc revert from FB4A to phabricator for general usage. This is my first stab,
so totally appreciate feedback and assistance. I'm currently focused
on making this work for git. However, I built out the functions through the GitAPI so this
could be easily extendable to Mercurial later on.

Stuck on the following (help):
1. Creating a task for FB internal. I tried building on top of existing arc listeners
but getting errors on failures to load the TaskCreator (and other) tasks.

2. I'm using a hacky way to grab the diff revision id from the newly created
revert diff. (see line 204) I'm looking for a way to just fetch the diff ID
from arc after the diff is created; is this possible?

Test Plan:
 -

1. Ran arc revert on a www and fbcode diff
2. Confirmed that revert was run on the diffs and a proper diff filed
 -

Reviewers: royw, sdwilsh, nh, epriestley

Reviewed By: epriestley

CC: aran, epriestley, Korvin, pti, keir

Maniphest Tasks: T1751

Differential Revision: https://secure.phabricator.com/D5553
2013-05-14 11:00:56 -07:00
Martin Kralik
3401b2a5d2 Added missing space between words in messages.
Summary:
During my attept to `arc land master` on `master` branch
I have discovered that error message is missing few spaces between words.

I have added them and used this ugly readonly command:

  pcregrep --include="\.php$" -M -r '(?<!\\n| )("|'"'"')\.\n\s*\1(?!\\n| )' ~/arc/arcanist/src

to detect other instances of this serious bug.

Two more were found.
This time they were probably introduced in order to abide
to the draconian lint rule about number of columns.

Since I want to be a good citizen,
I have added this missing space to the begining of the next line in both cases.
It is an ugly hack, but I think user should not suffer due to missing spaces.

Another solution could be preserving no leading spaces and splitting long lines.
Or just providing excuse to lint.

Test Plan: Ran `arc land master` on `master` branch.

Reviewers: epriestley, vrana

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T3008

Differential Revision: https://secure.phabricator.com/D5827
2013-05-03 16:12:17 -07:00
durham
b3108661bb Enable lint amending commits in mercurial
Summary:
arc lint was hardcoded for git for amending commits with lint
patches. This enables the same functionality for mercurial.

Test Plan:
Made some changes that would result in a lint patch.
arc diff

Verify that the patches it produces were amended into the commit.

Verified it still works in git as well.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D5716
2013-04-16 13:32:12 -07:00
durham
bfc1eeba07 Fix hg amend during arc diff
Summary:
When doing an arc diff with pending changes in your working copy
it was creating a new commit with the pending changes instead of amending
the existing one.  The problem was the author comparison was comparing
values like "John Smith <john@foo.com>" with "John Smith". The fix changes
$api->getAuthor() to return "John Smith" instead of the full string. This
matches the behavior (and implementation) found in the git api.

Test Plan:
hg book foo
touch a && hg commit -Ama
touch b && hg add b
arc diff
When prompted, amend the pending changes to the existing commit.

Verified that the changes were amended instead of making a new commit.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D5706
2013-04-16 10:22:00 -07:00
durham
f5c8430188 Change hg arc diff to detect up to the nearest parent with a diff
Summary:
Changes arc diff to choose the base commit as the first ancestor
that has a diff.  So if your tree looks like master->A->B->C->D, if you
have a diff on B (which will include A), when you run arc diff on D it will
only include C and D.

This makes the scenario for stacked diffs nicer.  A user can commit A, commit B,
arc diff, commit C, commit D, arc diff, arc land B, arc land D.

Test Plan:
Commit A on top of master
Commit B on top of A
arc diff
Commit C on top of B
Commit D on top of C
arc diff

Verify the second diff contains the changes in C and D, but not A and B.

hg up B
arc land --preview
Verify that arc land shows A and B

hg up D
arc land --preview
Verify that arc land shows A, B, C, and D
(arc land should be unaffected by this change.
It always tries to land the entire branch)

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D5639
2013-04-12 14:11:51 -07:00
Nick Harper
b1fe436cfc [svn] Fix removing a binary file without svn:mime-type set
Summary:
If we're removing a binary file that didn't have svn:mime-type set properly,
we can't propset it (because the file doesn't exist locally). Instead, just
return a synthetic diff for the removed file.

Test Plan:
run arc diff in an svn working copy where I ran svn rm on a binary file that
doesn't have svn:mime-type set, and the diff correctly gets uploaded to
phabricator instead of erroring when trying to set properties.

Reviewers: epriestley, wez

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D5655
2013-04-10 15:22:58 -07:00
durham
7c22017562 Allow 'arc diff .^' for hg repos
Summary:
Previously arc diff for hg only allowed bookmark names, rev numbers,
and commit hashes as the input base commit. This was because it escaped all
inputs and treated them as raw identifiers.

This change makes it treat the input as a revset if the escaped version fails.
This allows users to do things like "arc diff .^" when they only want to diff
the top commit.

Test Plan:
Created a stack of commits, master->A->B.
hg up B
arc diff .^
Verified the diff message only showed B as part of the diff.

arc diff .^~
Verified an error occurred ("Commit '.^~' is not a valid Mercurial commit id.")

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T2888

Differential Revision: https://secure.phabricator.com/D5638
2013-04-09 17:00:34 -07:00
Jakub Vrana
dbe0f7dc09 Invalidate SVN status cache after adding files
Summary: Cache invalidation is really one of the two hardest computer science problems.

Test Plan:
  lang=sh
  # in Subversion repository
  $ arc diff .arcconfig # untracked

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin, AnhNhan

Differential Revision: https://secure.phabricator.com/D5600
2013-04-06 09:25:35 -07:00