Commit Graph

52 Commits

Author SHA1 Message Date
timeless@gmail.com
cd35432d91 spelling: fix numerous spelling errors 2016-04-04 12:48:01 -07:00
Kostia Balytskyi
3137e3c69e tweakdefaults: make blame be able to show Phabricator diffs
Differential Revision: https://phabricator.fb.com/D3076727
2016-04-01 07:41:29 -07:00
Kostia Balytskyi
b24461e881 histgrep: add a config option to allow histgrepping on the whole repo
Differential Revision: https://phabricator.fb.com/D2921878
2016-02-11 03:39:59 -08:00
Kyle Lippincott
70d306b13d tweakdefaults: support pull --rebase -d <dest> without remotenames 2016-02-05 10:02:41 -08:00
Laurent Charignon
cc97eef022 cleanup: fix spacing (2 vs 4 spaces)
Summary: This diff is part of a series to cleanup fb-hgext and make it pass check-code.

Test Plan: all tests pass

Reviewers: #sourcecontrol, ttung

Differential Revision: https://phabricator.fb.com/D2811933
2016-01-07 18:30:24 -08:00
Laurent Charignon
a42808982c cleanup: fix the "line too long" warnings
Summary: This diff is part of a series to cleanup fb-hgext and make it pass check-code.

Test Plan: all tests pass

Reviewers: #sourcecontrol, ttung

Differential Revision: https://phabricator.fb.com/D2811926
2016-01-07 18:30:24 -08:00
Laurent Charignon
be7b9d9620 cleanup: remove gratuitous spaces
Summary: This diff is part of a series to cleanup fb-hgext and make it pass check-code.

Test Plan: all tests pass

Reviewers: #sourcecontrol, ttung

Differential Revision: https://phabricator.fb.com/D2811864
2016-01-07 18:30:24 -08:00
Laurent Charignon
b36541de7d cleanup: replace all the calls to util.Abort to error.Abort
Summary: This diff is part of a series to cleanup fb-hgext and make it pass check-code.

Test Plan: all tests pass like before

Reviewers: #sourcecontrol, ttung

Differential Revision: https://phabricator.fb.com/D2811837
2016-01-07 18:30:24 -08:00
Kostia Balytskyi
7e0f40375f #9421810: disable histgrep if ran on the whole repo
Differential Revision: https://phabricator.fb.com/D2769383
2015-12-18 05:59:43 -08:00
Kostia Balytskyi
bda30b50ec #9433233: made pats argument of histgrep being passed downstream
Differential Revision: https://phabricator.fb.com/D2768986
2015-12-17 07:36:58 -08:00
Eric Sumner
7f1d040e2c tweakdefaults: only apply default destination if rebasing or updating 2015-12-15 14:52:27 -08:00
Ryan McElroy
b991c57123 tweakdefaults: add default pull destination config
Summary: people have complained that this did not have a sensible default

Test Plan: added a new test

Reviewers: #sourcecontrol, cdelahousse

Reviewed By: cdelahousse

Subscribers: cdelahousse

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

Tasks: 9175076

Signature: t1:2698778:1448503081:defe2ec4a79b0a899107948472815a54a98d1fff
2015-11-25 18:23:07 -08:00
Ryan McElroy
2bf48d3eac tweakdefaults: abort updating pulls with no explicit destination
Summary: This allows unambiguous `hg pull --update` and `hg pull --rebase` calls.

Test Plan: Updated tweakdefault tests

Reviewers: #sourcecontrol, durham

Reviewed By: durham

Subscribers: durham

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

Tasks: 8252277

Signature: t1:2535805:1444783814:35a72356cf1eb67ebab908441ed613e3d606b0cb
2015-11-13 18:10:52 -08:00
Ryan McElroy
038e7b10d5 tweakdefaults: small style fixes 2015-11-13 18:12:21 -08:00
Stanislau Hlebik
a6281fff9e Make rebase set current date by default
Summary:
Previously rebase retained the commit date from the original. Now it uses current time.
Added config option 'tweakdefaults.rebasekeepdate' to save original date in graft.

Test Plan: ./run-tests.py test-tweakdefaults.t

Reviewers: rmcelroy

Reviewed By: rmcelroy

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

Tasks: 8770194

Signature: t1:2646736:1447368541:e9735f75b394a25b72d1a5cc4cd26454c2231c91
2015-11-12 01:36:21 -08:00
Ryan McElroy
5ebf193632 tweakdefaults: use falsy rather than empty string checks
Summary: Sometimes opts.get() returns empty string; sometimes it returns None.

Test Plan: existing tests

Reviewers: #sourcecontrol, cdelahousse

Reviewed By: cdelahousse

Subscribers: cdelahousse

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

Tasks: 8891268

Signature: t1:2590407:1446043207:e38d77ec13935fbdb12e7b7d9b9732c731c3e307
2015-10-28 07:41:52 -07:00
stash
26e3ddbdb0 Make commit --amend and amend set current date by default
Summary:
Previously commit --amend and amend retained the commit date from the original. Now it uses current time.
Added config option 'tweakdefaults.amendkeepdate' to save original date in graft.

Test Plan:
1) ./run-tests.py test-tweakdefaults.t

2) Add the following to ~/.hgrc


  [extensions]
  tweakdefaults = PATH_TO_tweakdefaults.py
  fbamend = PATH_TO_fbamend.py


Create repo



  hg init

Make a commit with date 0


  echo 1 >> test.txt && hg add test.txt && hg commit -d "0 0" -m "initial commit"


Amend a commit via "amend" command and check the date.




  echo 1 >> test.txt && hg amend && hg log -l 1


Do the same for "commit --amend" command


3) Add the following to ~/.hgrc



  [tweakdefaults]
  amendkeepdate = True

and repeat actions from step 2) (both for "commit --amend" and "amend"). Date should stay the same.

Reviewers: rmcelroy, #sourcecontrol, durham

Reviewed By: durham

Subscribers: durham, balazsbalazs

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

Tasks: 8770194

Signature: t1:2570763:1445539148:66b8b00ed51d486d39203dad830f4a50cdc8060d
2015-10-22 15:50:59 -07:00
stash
f99982a12b Replace KeyError with AttributeError
Summary:
When there is no method in the module 'AttributeError' is raised (at least on python 2.6.6)

Leave them both

Test Plan:
run-tests.py test-tweakdefaults.py



Reviewers: rmcelroy, durham, prologic

Reviewed By: durham, prologic

Subscribers: balazsbalazs

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

Signature: t1:2572948:1445564850:59bc6f030661f51b40965ec34d396a39d6e3f9ac
2015-10-22 15:40:42 -07:00
James Mills
fabaaca807 tweakdefaults: Set default nooprebase behavior and fix config checks
Summary: Makes the default behavior of nooprebase true.

Test Plan: ~/hg/tests/run-tests.py test-tweakdefaults.t

Reviewers: rmcelroy, durham

Reviewed By: durham

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

Signature: t1:2570362:1445538341:f62d29530fe5516d666fd496107dd314cdd9fae7
2015-10-22 08:04:15 -07:00
stash
d5c12360a4 Make graft set current date by default
Summary:
Previously graft retained the commit date from the original. Now it uses current time.
Added config option 'tweakdefaults.graftkeepdate' to save original date in graft.

Test Plan:
1) ./run-tests.py test-tweakdefaults.t

2)
Add the following to ~/.hgrc


  [extensions]
  tweakdefaults = PATH_TO_tweakdefaults.py



Create two bookmarks: test_1 and test_2, pointing to different commits

Graft commit from test_2 to test_1

  hg up test_1 && hg graft test_2

Check the date in the log - it should be different from the date of test_2 commit


  hg log -l 1


Add the following to ~/.hgrc



  [tweakdefaults]
  graftkeepdate = True



Strip latest test_1 commit



  hg strip test_1


Again do the graft



  hg up test_1 && hg graft test_2


and verify the commit date: should be the same as in test_2 commit

Reviewers: #sourcecontrol, rmcelroy, durham

Reviewed By: durham

Subscribers: balazsbalazs

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

Tasks: 8770194

Signature: t1:2566177:1445539026:2cd0b6b5b04247c17942f787d8921215def8e3fe
2015-10-21 14:26:15 -07:00
Christian Delahousse
987103cf0b tweakdefaults: reuse commit message flag
Summary: Added the --reuse-message/-M flag to `hg commit` via tweak defaults

Test Plan: See the tests

Reviewers: #sourcecontrol, durham, rmcelroy

Reviewed By: rmcelroy

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

Tasks: 8721257

Signature: t1:2559541:1445364124:db69a1b08defc0a84f314019ce1a01174e7006d3
2015-10-19 23:55:23 -07:00
James Mills
e1da7805e4 tweakdefaults: Setup a nooprebase behaviour for the rebase ext
Summary:
Adds configuration to .hgrc such that setting nooprebase = True
in the tweakdefaults section changes the behaviour of a noop
rebase such that the exit status is 0 (instead of 1).

Test Plan: See: https://phabricator.fb.com/P20083985

Reviewers: rmcelroy

Reviewed By: rmcelroy

Subscribers: dancol

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

Tasks: 8694501

Signature: t1:2557089:1445447745:fc35600d53f797d7242c2fcff9fac42867d7b651
2015-10-19 14:05:38 -07:00
Cecile Berillon
50d5a2d718 Moved merge comment to hint
Summary: Moved merge comment to hint in Abort

Test Plan: test output

Reviewers: rmcelroy

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

Tasks: 8593074
2015-10-08 11:32:39 -07:00
Cecile Berillon
89beed4ce9 Disabling rollback in tweakdefaults
Summary: Disabling rollback in tweakdefaults to replace the hook

Test Plan: testing the message

Reviewers: #sourcecontrol, rmcelroy

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

Tasks: 8578898
2015-10-06 16:10:24 -07:00
Cecile Berillon
0272f0d7ec Disabling merge in tweakdefaults
Summary: Disabling merge in tweakdefaults to replace the hook

Test Plan: enable, disabled, disabled and meaasge modified

Reviewers: #sourcecontrol, rmcelroy

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

Tasks: 8593074
2015-10-06 16:39:18 -07:00
Cecile Berillon
388e56c896 Adding config to allow disabling the branch command
Summary: Adding config to disable the branch command and still forcing users to pass --new if it's enabled

Test Plan: Testing branch alone, branch when it's disabled and when it's enabled (with the --new options in both cases)

Reviewers: #sourcecontrol, rmcelroy

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

Tasks: 8500803
2015-09-24 13:09:47 -07:00
Cecile Berillon
412d5aaec9 Changing tag disabled by default to tag enabled by default
Summary: Changing tag disabled by default to tag enabled by default

Test Plan: tag default policy, tag when disabled with or without default message

Reviewers: rmcelroy

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

Tasks: 8500389
2015-09-28 14:39:56 -07:00
Cecile Berillon
c521ae86f6 Adding tag tweak
Summary: Adding tag tweak and warning on the tags command

Test Plan:
Testing the tag command if allowed, not allowed with default message and not allowed with custom message
Testing if the default warning message or custom message prints when tags is called

Reviewers: durham, #sourcecontrol, rmcelroy

Reviewed By: #sourcecontrol, rmcelroy

Subscribers: cdelahousse, durham

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

Tasks: 8500389
2015-09-24 11:29:41 -07:00
Ryan McElroy
1e7a9fca92 tweakdefaults: fix bad relative behavior with hgwatchman
Summary:
Status on large repos got slow due to using re: and not '' and clowny
matcher behavior.

Test Plan:
In a large repo, I ran hg status with the old tweakdefaults and it consistently
took 10 seconds. Using the new tweakdefaults, it took 10 seconds the first time,
and was much faster afterwards.

I removed .hg/watchman.state and ran `hg status re:` with the old watchman and
it remained slow after multiple invocations. I ran `hg status re:` twice with
the new tweakdefaults and it was fast on the second invocation.

Reviewers: sid0, wez, #sourcecontrol, durham

Reviewed By: #sourcecontrol, durham

Subscribers: durham

Differential Revision: https://phabricator.fb.com/D2479154
2015-09-24 19:05:26 -07:00
Ryan McElroy
3724810d00 make status relative
Test Plan:
updated test; made sure to include `HGPLAIN`

ran `arc diff` from repo root and from subdir; both worked

In `fbsource/fbobjc` I ran `arc lint` and there were no warnings but it did fail to find `/usr/bin/xcrun` (which is the same behavior as before).
I repeated this in `fbsource/fbobjc/Configurations` to check for path issues; same result.

In `www` I ran `arc lint` and there were no warnings. I repeated this in `www/flib` and got the same result.

Reviewers: durham, #sourcecontrol

Reviewed By: durham, #sourcecontrol

Subscribers: durham, akushner

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

Tasks: 8432204

Signature: t1:2457648:1442622676:611ad3072d11b91feb947c0eb7eb25b621c61eb1
2015-09-18 10:20:49 -07:00
Ryan McElroy
7e8bf80a31 tweakdefaults: fix ordering issue for real
Summary: I thought we had already done this

Test Plan: Used new tweakdefaults and the rebase abort issue was fixed!

Reviewers: #sourcecontrol, durham

Reviewed By: #sourcecontrol, durham

Differential Revision: https://phabricator.fb.com/D2457645
2015-09-18 10:15:59 -07:00
Hunter Matthews
2bfa3be15a Update hg pull error message to suggest a fix for a naked hg up.
Summary:
Facebook disables naked "hg up" as found in many googled mercurial docs.
https://www.selenic.com/hg/help/update
https://www.selenic.com/mercurial/hg.1.html
http://hginit.com/01.html
etc.

We should have our error/abort messages make suggestions to correct course when
our configs conflict with upstream.

Test Plan:
"hg up --config extensions.tweakdefaults=~/fb-hgext/tweakdefaults.py"
in a repo that both needs updating to master and one in which it doesn't.

Results:
In repo needing an update:
/home/thm/fbsource/fbcode/tupperware/config/pe-security [thm@devvm1531]
> hg up --config extensions.tweakdefaults=~/fb-hgext/tweakdefaults.py
abort: You must specify a destination to update to, for example "hg up master".
(If you're trying to move a bookmark forward, try "hg rebase -d <destination>".)

Reviewers: durham

Differential Revision: https://phabricator.fb.com/D2348818
2015-08-14 15:18:15 -07:00
Ryan McElroy
b37d684953 tweakdefaults: update documentation 2015-08-12 14:53:26 -07:00
Ryan McElroy
6eede86d5d tweakdefaults: stop accidental branch command usage
Summary:
In the vast majority of cases, our workflows should not use branches.
Let's make sure people know what they're doing when they create a branch by
failing by default.

Test Plan: added a new test

Reviewers: durham, #sourcecontrol

Reviewed By: durham, #sourcecontrol

Subscribers: durham

Differential Revision: https://phabricator.fb.com/D2213677
2015-07-02 11:11:56 -07:00
Ryan McElroy
b9cc0ff986 tweakdefaults: ensure that tweakdefaults loads first
Summary:
Both remotenames and directaccess work best if they wrap tweakdefaults
instead of the other way around. While directaccess already takes care of this,
remotenames does not. Since remotenames is a more "general use" extension than
tweakdefaults, it feels better to change the order in this extension.

Test Plan:
Manually tested configs where tweakdefaults came before and after
remotenames. Before this change, remotenames rebase implicit tracking target
failed if tweakdefaults was listed after remotenmaes; after this change, it
worked regardless of the order the two extensions are listed inside of config
files.

Reviewers: lcharignon, durham

Reviewed By: durham

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

Signature: t1:2212774:1435854403:c651c73d806bcb9515a540c4e8f161a0f42ead69
2015-07-02 11:06:59 -07:00
Ryan McElroy
d4dc8ae3cd fb-hgext: update for bookmarks api compatibility
Summary:
Bookmarks apis are changing in core, need to update these extensions to not
break across that change.

Test Plan: ran tests against current and latest hg with bookmarks patches applied.

Reviewers: #sourcecontrol, durham

Reviewed By: #sourcecontrol, durham

Differential Revision: https://phabricator.fb.com/D2059856
2015-05-09 20:22:31 -07:00
Ryan McElroy
f19c04580a Merge fbonly into default
Summary:
A ton of tests in the 'default' branch are broken, yet they all work in 'fbonly' (because that's what we test and push).

Let's give the world all of our goodness. Bleeding edge is where it's at.

Top of hg sl now looks like:

```
@    386a20  rmcelroy
|\   merge fbonly into default
| |
o |  a284c7  rmcelroy  D1880107  remote/@
| |  githelp: add: mention that record and crecord make commits
| |
| o  f4870a  sid0  remote/fbtip  fbonly
| |  crecord: update to latest default
```

Test Plan: run-tests.py actually works now

Reviewers: davidsp, ericsumner, mitrandir, akushner, durham, sid0

Reviewed By: durham

Subscribers: lcharignon, mpm, ps

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

Signature: t1:1883891:1425613263:8c199f339596384aa7d089154ef99eb982ecff87
2015-03-08 12:22:25 -07:00
Drew Gross
d4e6c1d643 Fix a bug that prevents hg up -d from working properly with our extensions
Summary: Allows the user to specify a date and only a date on the command line, and still get to the commit they want

Test Plan: Use hg up -d in a few of the normal ways, such as hg up -d 'Jan 1', hg up -d '<Mar 1' and they should all work.

Reviewers: rmcelroy

Subscribers: nmead

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

Tasks: 6015872
2015-03-02 10:54:07 -08:00
Ryan McElroy
34be666d38 tweakdefaults: allow update to current rev when working copy is not clean
Summary:
https://www.facebook.com/groups/sourcecontrol/permalink/759079160808373/

Many thanks to @sid0 for guidance here.

Test Plan:
Ran this script:

  hg up master
  echo a >> README.txt
  arc feature foo

Before it failed, now it works.

Also a new test.

Reviewers: sid0

Reviewed By: sid0

Subscribers: hannesr, sid0

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

Tasks: 5810509

Signature: t1:1738821:1418669776:18cd358a99254f7552dacb9b9aa1599364b2d47d
2014-12-13 18:13:41 -08:00
Ryan McElroy
e32d2ef5da tweakdefaults: make update --check default; override with --nocheck
Summary:
After discussion in https://www.facebook.com/groups/sourcecontrol/permalink/755390834510539/ and playing around with the behavior,
I'm convinced this is the more user-friendly option for people. It's not git's behavior, but it's safer than git's and *way* safer
than mercurial's default.

Test Plan: Updated test

Reviewers: sid0, pyd, davidsp, durham

Reviewed By: durham

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

Signature: t1:1717431:1417654306:a584a85cfe76fd03d29a3391f83892af41d26cb6
2014-12-03 15:45:53 -08:00
Siddharth Agarwal
ee01e471d1 [tweakdefaults] add the ability to customize the grep command
Summary: For OS X I'm going to install a private copy of GNU `grep` to a directory not in the PATH. With this we'll be able to point to that copy of `grep`.

Test Plan:
I'm relying on the fact that GNU grep is a hell of a lot faster than BSD grep.

With GNU grep available at `/opt/facebook/libexec/mercurial/grep`, in fbandroid,

```
$ time hg --config grep.command=/opt/facebook/libexec/mercurial/grep grep <yubikey> java
0.81s
$ time hg grep <yubikey> java
4.65s
```

Reviewers: davidsp, akushner, pyd, daviser, rmcelroy, durham

Reviewed By: durham

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

Tasks: 4786323

Signature: t1:1654012:1415041229:9c5c175e650cea29e71bb3ce138edbc661771077
2014-10-31 19:13:32 -07:00
David Soria Parra
cddc80fd98 fb-hgext: add docstrings for extensions
Summary:
Most of our internal extensions don't have any docstringa causing hg help
to show nothing. I think this is confusing, as we teach people to use hg help.
In particular for our extensions they won't find anything on the internet
but hg help won't help either. So let's add rudimentary help texts.

Also ensure that gitnode is properly documented in hg help revset.

Test Plan:
added extensions, checked hg help and hg help extension. Also
checked hg help revset for gitnode.

Reviewers: rmcelroy, durham, sid0, akushner

Differential Revision: https://phabricator.fb.com/D1645964
2014-10-28 23:06:11 -07:00
Siddharth Agarwal
3352fc0344 [grep] ignore symlinks
Summary:
Previously, `hg grep` would follow symlinks because that's what `grep` does. This is a problem in fbcode because of all the tp2 and dewey symlinks. Handroll our iteration and ignore all files recorded as symlinks in the dirstate. This isn't perfect, but it's good enough and it's a lot faster than stating all the files.

Presumably we can integrate this with hgwatchman at some point.

Now, `hg grep <random string>` in fbcode takes just 2.6 seconds. (`git grep` takes 4.)

Test Plan: Ran tests.

Reviewers: daviser, akushner, davidsp, pyd, durham

Reviewed By: durham

Differential Revision: https://phabricator.fb.com/D1587863
2014-09-30 16:37:32 -07:00
Durham Goode
10667d93fd Move command wrapping to be inside extsetup
Summary:
Previously we wrapped commands at global initialization time, which is just
plain wrong (since other commands may not have even be initialized yet). Now we
do it inside extsetup.  It's mildly important that we do it in extsetup (vs
uisetup) because other extensions, like remotefilelog, wrap commands in the
uisetup and we want to make sure that our tweaks (like passing -f to log) come
first.  And by wrapping last, we get invoked first.

Test Plan: Ran the tests

Reviewers: sid0, davidsp, pyd

Differential Revision: https://phabricator.fb.com/D1578154
2014-09-25 11:34:07 -07:00
Siddharth Agarwal
883a155fdd [tweakdefaults] superpower grep
Summary:
Add a bunch of features to make `hg grep` full-featured.

- Support for basic, extended and Perl regexps.
- Support for filter patterns, including filesets.
- Support for color in the output.

Test Plan: Ran the tests, and ran `hg grep` against the repo.

Reviewers: davidsp, akushner, pyd, daviser, durham

Reviewed By: durham

Subscribers: robarnold

Differential Revision: https://phabricator.fb.com/D1578743
2014-09-25 13:50:36 -07:00
Erin Davis
51411dc368 Swapped the functionality of grep with wgrep and added histgrep
Summary: I added a grep command that does the wgrep alias. I also moved the traditional functionality of grep to histgrep. One thing missing is the help strings.

Test Plan:
I used both wgrep and my new grep on a couple queries in www. They returned the same results. I did similar things with the traditional grep and my histgrep.

I wrote tests in fb-hgext/tests/test-tweakdefaults.t and they passed.

Reviewers: pyd, davidsp, akushner, durham, sid0

Reviewed By: durham, sid0

Subscribers: akushner, micha

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

Tasks: 5162839
2014-09-24 15:11:10 -07:00
Siddharth Agarwal
d992bf1282 [tweakdefaults] fix rebase when destination contains a hyphen
Summary: With tweakdefaults `hg rebase` broke when the destination contained a hyphen. This made me sad :(

Test Plan: Tested rebase with hyphen, and ran tests.

Reviewers: pyd, durham

Reviewed By: durham

Differential Revision: https://phabricator.fb.com/D1565265
2014-09-18 17:22:14 -07:00
Siddharth Agarwal
bb96467321 [tweakdefaults] use hint for no-arg update message
Summary: This makes the error easier to read.

Test Plan: Ran `hg update`, saw that the error was printed across two lines.

Reviewers: durham

Reviewed By: durham

Differential Revision: https://phabricator.fb.com/D1542591
2014-09-08 12:43:38 -07:00
Durham Goode
d1e9ad4603 Fix hg update -r 2014-09-03 08:46:45 -07:00
Durham Goode
0df0625354 Fix 'update -r' to work with the new defaults
Summary:
The tweakdefaults extension broke 'hg update -r'. This fixes it and
adds a test.

Test Plan: Added a test.

Reviewers: sid0

Reviewed By: sid0

Differential Revision: https://phabricator.fb.com/D1506040
2014-08-19 11:21:45 -07:00