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

530 commits

Author SHA1 Message Date
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
Firehed
acb90fd9e7 fixes local svn branch name detection
Summary: Corrects relative vs absolute branch name when using 'arc commit'

Test Plan: 'arc commit' on a release branch gave an error before making the change (change was generated from 'branches/yyy' but working copy root is 'https://xxx/branches/yyy', now it does not.

Reviewers: epriestley

Reviewed By: epriestley

CC: Korvin, aran

Differential Revision: https://secure.phabricator.com/D6743
2013-08-13 14:16:14 -07:00
Eric Stern
c11b9e1af9 Fix 'arc lint --everything' when svn has uncommitted changes
Summary: My recent change adding --everything to arc lint could sometimes cause a "diff is empty" error, this patch fixes it.

Test Plan: Ran "arc lint --everything" before and after patch. No longer errors out. Only appeared to originally happen when there were uncommited changes in an svn repo.

Reviewers: epriestley

Reviewed By: epriestley

CC: Korvin, aran

Differential Revision: https://secure.phabricator.com/D6732
2013-08-12 13:47:43 -07:00
Mehdi Mulani
857b754c7e Use underscores instead of hyphens as bookmark suffixes.
Summary:
When trying to find an unused bookmark we append hyphened suffixes to the end of the bookmark name. In Mercurial, these are treated the same as the bookmark name without the suffix, here's the output from hg log -r:

```
[mehdi] HGPLAIN=1 hg log -r "arcpatch-1"
abort: unknown revision 'arcpatch'!
[mehdi] HGPLAIN=1 hg log -r "arcpatch_1"
abort: unknown revision 'arcpatch_1'!
```

Test Plan: None.

Reviewers: epriestley, dschleimer

Reviewed By: dschleimer

CC: aran, Korvin, DurhamGoode, dschleimer

Differential Revision: https://secure.phabricator.com/D6698
2013-08-07 14:56:03 -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
Aviv Eyal
d54f0f69d4 arc unit --output none
Summary:
Support for no output from arc unit (For scripts, etc).
Also include --output param, analogous to arc lint --output.

Test Plan: run all 6 variants + `--output bad-value`

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D6642
2013-08-01 12:07:21 -07:00
durham
5b69749812 Remove hard coded single quotes in arc feature
Summary:
Single quotes aren't valid in the windows cmd prompt, so arc feature
didn't work in mercurial when it got to this line.

I have no idea why %C was used before.  Nothing in that string should be
broken by the escaping.

Test Plan:
Ran arc feature --trace on my mac. Verified the command was escaped correctly
and the correct feature results were printed.

I don't have a windows machine to try it on, but the builtin escaping should
now account for windows machines.

Reviewers: epriestley

Reviewed By: epriestley

CC: sid0, aran, Korvin

Differential Revision: https://secure.phabricator.com/D6637
2013-08-01 10:14:38 -07:00
Eric Stern
12f2175da1 Add --everything support to 'arc lint'
Summary:
When adding arcanist support to a new project or adding a new linter,
it's helpful to be able to run new linters against the entire codebase. This
patch adds support for this with an '--everything' option, similar to 'arc unit
--everything'

Test Plan:
Run 'arc lint --everything' and check out the code. Optionally dump
the paths to test in the current lint engine's buildLinters() function to
demonstrate that it's receiving all files in the project rather than just the
changed and/or specified ones

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D6592
2013-07-27 18:29:20 -07:00
Aviv Eyal
46bb3dbc36 arc browse: Support line number and reduce conduit call
Summary:
support common "filename:line number" format.
Also, remove redundent conduit call.

Test Plan: arc browse with and without :33 suffix.

Reviewers: epriestley, vrana

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D6451
2013-07-14 19:17:02 -07:00
epriestley
910df64d31 Stop using deprecated Conduit methods in arc
Summary:
  - Replace `maniphest.find` with `maniphest.query`. These calls are nearly identical, it was just a rename for consistency.
  - Replace `differential.find` with `differential.query`.

Test Plan:
  - Ran `arc tasks`.
  - Ran `arc close-revision` on valid, nonexistent, and existent-but-invalid revisions.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Differential Revision: https://secure.phabricator.com/D6336
2013-07-02 05:47:52 -07:00
Gareth Evans
a746ad8757 Update some output based on flag being set
Summary: Makes sense now

Test Plan: Get someone else to test it

Reviewers: epriestley

CC: aran, Korvin

Maniphest Tasks: T3342

Differential Revision: https://secure.phabricator.com/D6307
2013-06-25 15:26:14 -07:00
Gareth Evans
4f3dee80e5 Allow passing library name with flag
Summary: Enables the process to pass the user input for library name. Fixes T3342

Test Plan: Little help... `arc liberate` doesn't run on windows. Though I saw the flag :)

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T3342

Differential Revision: https://secure.phabricator.com/D6306
2013-06-25 15:20:30 -07:00
durham
b713eb51c9 Don't prepopulate update message in hg amend diff workflow
Summary:
Previously, updating a commit via arc diff in mercurial would
prepopulate the update message with part of the commit message.  In an
amend workflow this doesn't make sense, so I disabled it. Git already
does this, so now mercurial matches git in this scenario.

We had users complain that new users would often submit diffs with the
default update message, and it wasn't useful since they were using a
amend flow.

Test Plan:
arc diff on a commit that already had a diff
Verified the editor did not have a update message
arc diff on a stack of commits where the bottom one had a diff
Verified the editor provided a default update message

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D6215
2013-06-17 11:40:58 -07:00
epriestley
c38bc4376c When a file upload fails during "arc diff", show why
Summary: We currently swallow the exception message, but this isn't useful. Fixes T3354.

Test Plan:
  $ arc diff HEAD^ --conduit-uri=http://local.aphront.com:8080/ --only
  Uploading 1 files...
  Failed to upload new binary 'large.png'.

  [HTTP/500] Internal Server Error
  As received by the server, this request had a nonzero content length but no POST data.

  Normally, this indicates that it exceeds the 'post_max_size' setting in the PHP configuration on the server. Increase the 'post_max_size' setting or reduce the size of the request.

  Request size according to 'Content-Length' was '2093052', 'post_max_size' is set to '100K'.

      Continue? [Y/n]

Reviewers: jamesr, chad

Reviewed By: chad

CC: aran

Maniphest Tasks: T3354

Differential Revision: https://secure.phabricator.com/D6186
2013-06-12 05:50:08 -07:00
epriestley
2e61b1a3df Fix a catch class name
Summary: Now that we examine these in lint, this came up. There is no `ConduitException`; the class is `ConduitClientException`.

Test Plan: Lint.

Reviewers: vrana, chad

Reviewed By: chad

CC: aran

Differential Revision: https://secure.phabricator.com/D6158
2013-06-11 06:26:42 -07:00
epriestley
e93726cb3b Fix some Arcanist lint warnings
Summary: Lint. See https://github.com/facebook/phabricator/pull/332

Test Plan: Lint.

Reviewers: chad

Reviewed By: chad

CC: aran

Differential Revision: https://secure.phabricator.com/D6126
2013-06-04 15:29:39 -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
Gareth Evans
4c37e6ff4a Allow an unassigned flag to be passed to arc tasks
Summary: Returns unassigned tasks

Test Plan: Run `arc tasks`, `arc tasks --unassigned`, make sure I get the correct results

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T3201

Differential Revision: https://secure.phabricator.com/D6009
2013-05-23 10:36:40 -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
epriestley
957249f56c Disable lint cache by default
Summary:
Fixes T2266. Motivation:

  - The lint cache does not always invalidate correctly. Because of the nature of the cache, this is a hard problem (right after "naming things").
    - We already have a fair amount of complexity in trying to invalidate it, and are still discovering new places where it doesn't work (e.g., Windows with "/" vs "\" paths).
    - One invalidation failure is when linter code changes, which seems unresolvable in the general case (e.g., changes to external linters).
  - It's not obvious what's happening when the lint cache causes some kind of issue.
    - Particularly while developing or debugging linters, your changes often won't be reflected in the lint output. Some of this is theoretically tractable but the external linter case probably isn't.
  - When someone reports a problem with the lint cache in IRC or elsewhere, there is essentially never a way for me to fix it. The lint cache can't be debugged effectively without access to a working copy where the problem reproduces.
  - The cache provides limited benefit outside of Facebook's install.

To remedy these issues:

  - Introduce configuration which controls cache usage.
  - Default it off.
  - Print a message when the cache is in use.

(I'd tentatively support removing the cache entirely, but I don't know how @vrana and Facebook feel about that.)

Test Plan: Ran `arc set-config --show`, `arc lint --cache 0`, `arc lint --cache 1`.

Reviewers: vrana, btrahan

Reviewed By: vrana

CC: aran, mbishopim3, nh, edward, wez

Maniphest Tasks: T2266

Differential Revision: https://secure.phabricator.com/D5766
2013-04-23 11:26:28 -07:00
san
410ea5dc32 Adding -- to the end of git log so can arc land when the branch is
named the same as a file path.

Summary: (In fbcode and www at least, the only places I tried) if a
branch happens to be named the same as a file path (from root) (like if
a branch is called `spec` and there is a directory in `www` called
`spec`) then `arc land` will fail with git complaining that the argument
(to `git log ...`) is ambiguous as it could refer to both a path and a
revision; so this diff adds a `--` to the end so that git knows that
both are revisions and not paths.

Test Plan: Try and land something from www (I did, see D752219) where
the branch is named `spec`.

Reviewed by: epriestley
2013-04-23 06:37:38 -07:00
Jakub Vrana
c0ff9852af Move Arcanist machine config location on Windows
Test Plan:
  $ set # on Windows

Reviewers: epriestley, dschleimer

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D5733
2013-04-19 22:12:02 -07:00
durham
07fba2a49b Fix arc lint amend for git to not add untracked files
Summary:
Arc lint for git is currently adding all untracked files when it
amends the commit with lint fixes. This changes the git add -A to be
git add -u. This only adds files that were already tracked. -A was adding
untracked files as well which was not the desired behavior here.

Test Plan:
Create an untracked file.
Commit a lint failure another file.

arc diff and choose to amend the lint patches.

Verify that the untracked file was not added but the tracked file was amended.

Reviewers: epriestley, wez, chad

Reviewed By: chad

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D5731
2013-04-18 20:03:26 -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
epriestley
b0a0414766 Construct a diganostic parser in BaseWorkflow::getChange()
Summary:
@ender is reporting a parsing issue in SVN, but we don't build a parser with setWriteDiffOnFailure() set in this workflow right now so I can't get the raw file to fix the issue.

Use the onboard mechanism to build a parser with `setWriteDiffOnFailure()` set, so it will write the diff, so I can get a copy so I can fix the problem.

Test Plan: Ran `arc diff --preview` in an SVN repo with a linter.

Reviewers: ender, btrahan

Reviewed By: ender

CC: aran

Differential Revision: https://secure.phabricator.com/D5699
2013-04-15 12:30:56 -07:00
durham
e573610ce4 Add arc.land.update.default config for setting the default strategy
Summary:
This adds a arcconfig setting to allow specifying whether to use the merge
or rebase strategy when doing the feature branch update.
arc.land.update.default can be set to either 'rebase' or 'merge'.  The command
line flags will override this setting.

We have had trouble with arc land producing merge commits (introduced
with D4080) in git. They usually appear when arc land fails, and our users
are confused by the presence of a merge commit afterwards. Today it got even
worse since a user managed to get arc land to push the merge commit to the
server. This setting will allow us to turn it off for our uses.

Test Plan:
Verified the following combinations:
update.default not set + arc land (saw git merge in the trace)
update.default = 'rebase' + arc land (saw git rebase)
update.default = 'merge' + arc land (saw git merge)
update.default = 'rebase' + arc land --update-with-merge (saw git merge)
update.default = 'merge' + arc land --update-with-rebase (saw git rebase)

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D5683
2013-04-14 11:48:22 -07:00
Jakub Vrana
3af36c6a4e Hide Git merge stats in arc land
Test Plan:
  $ arc land # in Git repo

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D5599
2013-04-06 09:23:41 -07:00
Jakub Vrana
c77ec2bdc6 Escape ^ on command line (significant on Windows) 2013-04-05 23:17:40 -07:00
Jakub Vrana
576c47aaa1 Don't use command output as formatted string in arc land 2013-04-05 23:09:35 -07:00
epriestley
ac0aa330f5 Don't use emailuser in Mercurial
Summary:
The `emailuser` template is a relatively recent addition to Mercurial, and a few users have complained about it. It also doesn't actually do what I thought it did, e.g. in an address like this:

  "Abraham Lincoln" <alincoln@whitehouse.gov>
   ^^^^^^^^^^^^^^^   ^^^^^^^^
         (1)            (2)

                     ^^^^^^^^^^^^^^^^^^^^^^^
                              (3)

...I want (1), but `emailuser` means (2). Instead, extract (1) with `getDisplayName()` and (3) with `getAddress()` using PhutilEmailAddress.

The implementation in Mercurial is not particularly sophisticated or magical (it just looks for "@" and "<") so we aren't really missing anything by doing this ourselves, at least today.

Also fix some issues in `arc export`, which literally no one uses, but which is occasionally useful for testing (as here).

Test Plan:
  - Ran `arc diff --only` in an `hg` repo, checked DB to see that name/email were correctly extracted.
  - Ran `arc export --git` in an `hg` repo, didn't get a long series of fatals.

Reviewers: btrahan, DurhamGoode

Reviewed By: DurhamGoode

CC: aran

Maniphest Tasks: T2866, T2858

Differential Revision: https://secure.phabricator.com/D5539
2013-04-02 14:06:46 -07:00
durham
b7a2766130 Make arc land list the commits being landed.
Summary:
Arc land is a bit magical and some users have gotten bitten by
the fact that it collapses and lands every commit on the branch. To make
it explicit what is being landed, it now shows a list of the commits
that are being landed.  I also added a --preview flag that will just
print the commits that would be landed, but does nothing else.

Hopefully this make arc land a little less magical for people.

Test Plan:
arc land in the following scenarios:
- Landing one change
- Landing no changes
- Landing a stack of changes

Did it with hg and git.

Reviewers: epriestley

Reviewed By: epriestley

CC: nh, sid0, dschleimer, bos, aran, Korvin

Differential Revision: https://secure.phabricator.com/D5460
2013-03-29 10:08:23 -07:00
Jakub Vrana
d1027c186c Add missing image functions to PHP extension functions list
Summary:
Copied from PHP Manual.

Also fix missing cache key for implicitly linted file.

Test Plan:
  phabricator/ $ arc lint src/applications/files/PhabricatorImageTransformer.php # without GD2

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin, AnhNhan

Differential Revision: https://secure.phabricator.com/D5457
2013-03-28 05:04:37 +00:00
Jakub Vrana
50b4f0af65 Don't connect to Conduit in arc feature name
Summary: There's no need for having an Internet connection in creating a branch.

Test Plan:
  $ arc feature name # with disabled Internet
  $ arc feature
  [cURL/6] (https://secure.phabricator.com/api/conduit.connect)

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D5430
2013-03-22 17:33:07 -07:00
durham
ba78000b38 Make arc patch create a bookmark by default in hg
Summary:
Previously, arc patch would create a new commit under the existing
current bookmark in mercurial. There have been two discussions about what the
right behavior should be (D3334 and D3658). One side wants no commit at all,
and one side wants a commit under a new bookmark. The current implementation is
the worst of both worlds :(

This change makes it create a new bookmark at the revision's base before commiting,
same as the --bookmark flag used to do (which is now obsolete). That way the
existing bookmark doesn't move (in mercurial >=1.8). This is the same behavior
git has, which is convienent for groups migrating between the two.

Also makes hg's getCanonicalRevision handle svn revisions just like git. This way
arc patch will try to apply the patch to the appropriate revision in the history.

Test Plan:
Ran:
arc patch - Verified it created a new bookmark and commited on top of the
revision's base commit.

arc patch --nobranch - Verified it put the new commit on top of the current
bookmark without a new bookmark.

arc patch --nocommit - Verified it left all the changes in the working copy.

Also verified arc patch still works with git.

Reviewers: epriestley

Reviewed By: epriestley

CC: sid0, bos, dschleimer, aran, Korvin

Differential Revision: https://secure.phabricator.com/D5408
2013-03-21 17:52:07 -07:00
James Rhodes
2900ab6abd Added automatic stash / unstash support for Git in arc diff.
Summary:
- Added arc.autostash option to have this behaviour off by
default (but configurable on a per-project basis).
- Automatic stashing of changes now informs the user of how
to restore their working directory if Arcanist unexpectedly
terminates.
- Fixed an issue with finalizeWorkingCopy when the workflow
didn't require a clean working copy.

Test Plan:
Test `arc diff` when there are changes in the working
directory; by default it should tell you to stash or commit.
Turn on the arc.autostash option and try again; it should
automatically stash with a message on how to recover, and
it should restore the working directory automatically under
almost any circumstances (other than an unrecoverable error).

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D5385
2013-03-21 16:00:05 -07:00
durham
9963323b91 Make arc land for hg more robust to failures
Summary:
Adds error handling for several kinds of failure in arc land for
mercurial.  Previously it would often leave the repo in a confusing state
if something failed.

- Aborts the land if pull brings in a diverged 'onto' branch.
- Aborts the rebase if there is a conflict. This leaves the repo exactly as
it was before, so the user is not left with a half finished rebase.
- Don't delete the original non-squashed branch until the push succeeds.
- If the push fails, strip the temporary squashed commit. This leaves the
'onto' branch back on the latest commit from the server, and leaves the users
original nonsquashed branch around.
- Always leave the user back on their original branch after an error.

Test Plan:
Ran arc land:
- with pull causing a diverged 'onto' bookmark
- with the 'onto' bookmark already diverged
- with the rebase causing conflicts
- with a push that failed due to a commit hook
- with a successful land
- with a successful collapse and land

In all failure cases the repo was left exactly as it was before arc land,
except for the push-failed case, where the only change was that the branch
was correctly on top of the destination branch due to a successful rebase.

Used bookmark name "foo bar-gah" to test that crazy bookmark names still work.

Reviewers: epriestley, dschleimer, sid0

Reviewed By: epriestley

CC: nh, wez, bos, aran, Korvin

Differential Revision: https://secure.phabricator.com/D5394
2013-03-20 15:06:10 -07:00
durham
b6e83c7b35 Fix arc patch adding unnecessary files for hg repos
Summary:
Arc patch was committing with -A (--addremove) which meant any random
files that were sitting around in the repo (like conflict .orig files) were
added to the commit.  The -A isn't even necessary since the hg import
adds and removes all the appropriate files for you.

Test Plan:
touch foo
arc patch --diff some-diff-id
Verified that foo was not added to the commit

Reviewers: epriestley, nh

Reviewed By: epriestley

CC: dschleimer, bos, sid0, aran, Korvin

Differential Revision: https://secure.phabricator.com/D5396
2013-03-20 14:40:28 -07:00
durham
b06237cb2d Change arc feature to use it's own config key for the start default
Summary:
Changes arc feature to read 'arc.feature.start.default' instead
of 'arc.land.onto.default'.  In our usage we actually need to fork off
a different branch than we land to, so separating these is useful.

Test Plan:
Set arc.land.onto.default = master
Set arc.feature.start.default = bar
arc feature foo
cat .git/config
Verified the foo branch tracked bar

Reviewers: epriestley, nh

Reviewed By: epriestley

CC: wez, dschleimer, aran, Korvin

Differential Revision: https://secure.phabricator.com/D5336
2013-03-13 17:01:23 -07:00
Jakub Vrana
4fd8b88833 Compute lint cache key before linting
Summary: If user changes the file contents during linting (usually when prompted to apply a patch) then we save the old messages to the new file contents. Fix that by computing the hash before linting (or after applying patch).

Test Plan: Changed the file during linting, verified that the file hash didn't change.

Reviewers: epriestley

Reviewed By: epriestley

CC: ptarjan, aran, Korvin

Differential Revision: https://secure.phabricator.com/D5320
2013-03-10 22:31:13 -07:00
Jakub Vrana
a925ef9dc1 Improve Windows compatibility
Test Plan:
  $ arc liberate
  $ arc lint

Reviewers: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D5319
2013-03-10 18:08:41 -07:00
Alok Menghrajani
7bf26484fb Dispatch an event in arc land right before pushing a revision
Summary: I looked at the pros & cons at adding hooks in git/hg vs arc land and I prefer arc land.

Test Plan:
* added an event listener and made sure I could handle the event.
* made sure things get reverted when the event handler throws an exception.

Reviewers: vrana, epriestley, pieter

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D5268
2013-03-08 18:32:36 -08:00
vrana
c4773c87ba Improve the description of using arc land --revision
Summary: The message suggests that only one revision would land.

Test Plan: Read it.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D5277
2013-03-07 21:28:04 -08:00
epriestley
42235d9f1f Minor, fix arc land for the case of no dependencies.
Auditors: Afaque_Hussain
2013-03-07 17:22:24 -08:00
Afaque Hussain
dd3d33c610 If a revision depends on another revision which has not yet been closed, warn the developer
Summary: Have arc land inspect the revision if it depends on some other revisions which haven't been closed yet. If yes, then warn users.

Test Plan: Will test them locally.

Reviewers: epriestley, AnhNhan

CC: aran, Korvin, AnhNhan

Differential Revision: https://secure.phabricator.com/D5262
2013-03-07 09:02:51 -08:00
durham
64bbcda431 Add arcconfig setting for default arc feature start
Summary:
Adds arc.feature.start.default arcconfig setting to specify
a default value for 'start' in 'arc feature name start'. This lets
users always branch from origin/master (or whatever the main branch is).

Also cleaned up the 'feature' help text a little. The stuff about sorting
and closed/abandoned revisions is explained via the options list already.

Test Plan:
Ran arc feature with/without a start and with/without the config
setting set.

Reviewers: epriestley, vrana

Reviewed By: epriestley

CC: bos, sid0, dschleimer, aran, Korvin

Differential Revision: https://secure.phabricator.com/D5184
2013-03-05 12:48:53 -08:00
Ryan Patterson
eed7e70bb1 arc feature set up git tracking branch
Summary:
When using arc feature, it should set up the tracking branch to be
master.

Test Plan:
  ./bin/arc feature tracking

Reviewers: vrana, epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D5169
2013-03-03 21:43:59 -08:00
vrana
ebe464b6f0 Respect British spelling also in arguments
Summary: These are the errors I really do.

Test Plan:
  $ arc diff --no-lint
  (Assuming '--no-lint' is the British spelling of '--nolint'.)
  $ arc diff --reviewer a
  (Assuming '--reviewer' is the British spelling of '--reviewers'.)

New unit test.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D5185
2013-03-01 16:53:26 -08:00
mconnor
0e254f769d Use bookmark terminology if arc land on hg bookmark
Summary: Changes message for `arc land` that displays current branch or bookmark (if none is specified) to appropriately use the term 'bookmark' when on a bookmark in an hg repository.

Test Plan:
Ran `arc land` on new git and hg repositories, checking for correct identification of 'branch' or 'bookmark'.

~/test$ mkdir hg-test
~/test$ mkdir git-test
~/test$ cd hg-test
~/test/hg-test$ hg init
~/test/hg-test$ hg branch
default
~/test/hg-test$ hg bookmarks
no bookmarks set
~/test/hg-test$ arc land
Landing current branch 'default'.
Usage Exception: You can not land a branch onto itself -- you are trying to land 'default' onto 'default'. For more information on how to push changes, see 'Pushing and Closing Revisions' in 'Arcanist User Guide: arc diff' in the documentation. You may be able to 'arc amend' instead.
~/test/hg-test$ hg bookmark testmark
~/test/hg-test$ hg bookmarks
 * testmark                  -1:000000000000
~/test/hg-test$ hg branch
default
~/test/hg-test$ arc land
Landing current bookmark 'testmark'.
Usage Exception: Source testmark is a bookmark but destination default is not a bookmark. When landing a bookmark, the destination must also be a bookmark. Use --onto to specify a bookmark, or set arc.land.onto.default in .arcconfig.

Confirm still works on a git branch:

~/test/hg-test$ cd ../git-test/
~/test/git-test$ ls
~/test/git-test$ git init
Initialized empty Git repository in ~/test/git-test/.git/
~/test/git-test$ touch testfile
~/test/git-test$ git commit -am 'Test file'
~/test/git-test$ git branch
* master
~/test/git-test$ arc land
Landing current branch 'master'.
Usage Exception: You can not land a branch onto itself -- you are trying to land 'master' onto 'master'. For more information on how to push changes, see 'Pushing and Closing Revisions' in 'Arcanist User Guide: arc diff' in the documentation. You may be able to 'arc amend' instead.

Reviewers: DurhamGoode, epriestley

Reviewed By: DurhamGoode

CC: aran, epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D5163
2013-03-01 14:04:05 -08:00
vrana
2e87419c7b Render unit results progressively
Summary:
Some tests take longer (fixtures usually around 1 second for me) and also FB runs all tests on deploy.
I want to see all results immediately.

Test Plan:
Added `usleep(200000)` to `resultTest()`, then:

  $ arc unit
  Saw results printed one by one.

Also didn't pass `$renderer` to `ArcanistPhutilTestCase` and saw empty output.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D5141
2013-02-28 15:33:21 -08:00