Commit Graph

12 Commits

Author SHA1 Message Date
Ryan McElroy
4033d08e4d scm-prompt: add test for hg behavior
Test Plan: ~/hgdev/hg/tests/run-tests.py -l

Reviewers: #sourcecontrol, lcharignon

Reviewed By: lcharignon

Subscribers: lcharignon, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D3121692

Tasks: 10618514

Signature: t1:3121692:1461866367:d9e7b4a7fe2e8425027fcfa84cdf474acc17b1d6
2016-04-29 06:44:32 -07:00
Ryan McElroy
78ff089e6a scm-prompt: deal with shared bookmarks 2016-04-29 06:36:09 -07:00
Ryan McElroy
fc6fdac261 scm-prompt: follow physical directories when finding root 2016-04-29 06:36:09 -07:00
Ryan McElroy
e058b78a4e scm-prompt: add quotes to accommodate paths with spaces 2016-04-29 06:36:09 -07:00
Wez Furlong
e71ecbab09 fb-hgext: improve check code linter integration
Summary:
if you run `arc lint --output json` and don't have your environment correctly set up, the failure to run the linter was silently ignored.

I wanted to fix that, but then realized that we could integrate this better without too much effort, hence this diff.

This is a small python script that processes the output from the check code test and captures the appropriate context so that `arc lint` can show you where in the code the problem(s) lie.

Test Plan:
This is the output when the environment is not set up correctly:

```
 $ arc lint


>>> Lint for lint.py:

   Error  (S&RX) ENVIRON
    Please either set MERCURIALRUNTEST env var to the full path to
    run-tests.py, or add the containing directory to your $PATH

    >>>        1

   Error  (S&RX) ENVIRON
    Please either set MERCURIALRUNTEST env var to the full path to
    run-tests.py, or add the containing directory to your $PATH

    >>>        1
```

This is the same thing but in json output mode:

```
$ arc lint --output json
{".arcconfig":[]}
{"scripts\/lint.py":[]}
{"lint.py":[{"line":"1","char":null,"code":"S&RX","severity":"error","name":"ENVIRON","description":"Please either set MERCURIALRUNTEST env var to the full path to run-tests.py, or add the containing directory to your $PATH","original":null,"replacement":null,"granularity":1,"locations":[],"bypassChangedLineFiltering":null,"context":""},{"line":"1","char":null,"code":"S&RX","severity":"error","name":"ENVIRON","description":"Please either set MERCURIALRUNTEST env var to the full path to run-tests.py, or add the containing directory to your $PATH","original":null,"replacement":null,"granularity":1,"locations":[],"bypassChangedLineFiltering":null,"context":""}]}
```

This shows the lint errors from my `hg publish` stack:

```
>>> Lint for phabricator/arcconfig.py:

   Error  (S&RX) CheckCode
    don't raise generic exceptions

              18 def load_for_path(path):
              19     homedir = os.getenv('HOME')
              20     if not homedir:
    >>>       21         raise Exception('$HOME environment variable not found')
              22
              23     # Use their own file as a basis
              24     userconfig = _load_file(os.path.join(homedir, '.arcrc')) or {}
```

Reviewers: #sourcecontrol, ttung, lcharignon

Reviewed By: lcharignon

Subscribers: mjpieters

Differential Revision: https://phabricator.fb.com/D3203666

Signature: t1:3203666:1461185075:e9b03c8251d7e3b8e965b81146d17cdeac75d837
2016-04-21 08:54:54 -07:00
Jun Wu
3768f713e9 Add editorconfig
Summary:
Editorconfig (http://editorconfig.org/) is a file format helping define coding
styles like spaces, tabs etc. It supports a wide range of editors. The upstream
is using it already.

This patch adds a simple .editorconfig, making it clear we use 8-char tabs in
C code, 4-char spaces in Python and Shell scripts, and we don't keep trailing
spaces.

Besides, do a style fixes for `scripts/runcheckcode.sh`. But note that
`scripts/scm-prompt.sh` is left untouched since it was copied from other
repository and we may sync it later.

Test Plan:
Use `gg=G` in vim to format `scripts/runcheckcode.sh` and make sure it does
not showed up in Phabricator with space changes ignored.

Reviewers: #sourcecontrol, durham, ttung

Reviewed By: durham

Subscribers: durham, mjpieters

Differential Revision: https://phabricator.fb.com/D3197242

Signature: t1:3197242:1461129423:e24a898370f8e8eb9bea8be414fee8670f06c16d
2016-04-20 03:05:42 -07:00
Jun Wu
a57b447851 runcheckcode: make lz4revlog an optional requirement
Summary:
Before this patch, `runcheckcode.sh` sets an extra config option
`extensions.lz4revlog=`, which will break if lz4revlog is not installed
in the system. This patch drops the config option if the repo does not
require `lz4revlog`.

Test Plan: Run `runcheckcode.sh` in both lz4revlog and non-lz4revlog repos.

Reviewers: #sourcecontrol, ttung

Reviewed By: ttung

Subscribers: mjpieters

Differential Revision: https://phabricator.fb.com/D3196200

Signature: t1:3196200:1461088741:11cfc8f3236f471e060e768c01a772072543e6fc
2016-04-19 11:00:44 -07:00
Laurent Charignon
b8efa60b36 arc: add a linter for check-code
Summary:
It was too easy to check in code that was not passing check-code. I
got tired of fixing it so let's add a linter :)

Test Plan:
Test that the linter works as expected and asks the user to provide
the location of run-tests.py if not set.

Reviewers: #sourcecontrol, ttung

Subscribers: mjpieters

Differential Revision: https://phabricator.fb.com/D3153365
2016-04-08 15:36:32 -07:00
Jing Qian
fa40278190 copy remote_bookmark reflog when sharing 2016-03-23 22:47:54 -07:00
Xudong Wang
f97848cf4b fixing hg-new-workdir script problem
Summary: Fixing issue [[ http://www.facebook.com/groups/sourcecontrol/permalink/908533209196300/?comment_id=908544142528540&offset=0&total_comments=3 | here ]]

Test Plan:
  $ hg-clone-fbsource --no-working-dir
  $ hg-new-workdir ~/fbsource/ ~/fbandroid/

expect hg not updating to tip

Reviewers: quark, rmcelroy

Reviewed By: rmcelroy

Differential Revision: https://phabricator.fb.com/D2700764

Tasks: 9048802

Signature: t1:2700764:1448914720:1218c99891cdd4be40369626cfc7d0c9c41ba811
2015-11-30 22:07:59 +00:00
Ryan McElroy
6653644dc8 add scm-prompt.sh 2015-05-13 10:49:24 -07:00
Ryan McElroy
e4914e56d3 add hg-new-workdir 2015-05-13 13:15:59 -07:00