├── .gitignore ├── .pylint.rc ├── .travis.yml ├── CONTENTS.md ├── CONTRIBUTING.md ├── DCO.md ├── LICENSE ├── README.md ├── autofix.sh ├── bin ├── arcyon └── phab-ping ├── doc ├── design │ └── r_branch_naming_scheme.txt └── man │ ├── arcyd │ ├── arcyd.generated.txt │ ├── arcyd_add-phabricator.generated.txt │ ├── arcyd_add-repo.generated.txt │ ├── arcyd_add-repohost.generated.txt │ ├── arcyd_fetch.generated.txt │ ├── arcyd_fsck.generated.txt │ ├── arcyd_init.generated.txt │ ├── arcyd_list-repos.generated.txt │ ├── arcyd_rm-repo.generated.txt │ ├── arcyd_start.generated.txt │ └── arcyd_stop.generated.txt │ ├── arcyon │ ├── arcyon.generated.txt │ ├── arcyon_comment-inline.generated.txt │ ├── arcyon_comment.generated.txt │ ├── arcyon_create-revision.generated.txt │ ├── arcyon_get-diff.generated.txt │ ├── arcyon_inline-comment.generated.txt │ ├── arcyon_paste.generated.txt │ ├── arcyon_query.generated.txt │ ├── arcyon_raw-diff.generated.txt │ ├── arcyon_show-config.generated.txt │ ├── arcyon_task-create.generated.txt │ ├── arcyon_task-query.generated.txt │ ├── arcyon_task-update.generated.txt │ └── arcyon_update-revision.generated.txt │ └── barc │ ├── barc.generated.txt │ └── barc_list.generated.txt ├── docker ├── arcyd-cluster │ ├── arcyd-cluster-dockerfile │ ├── arcyd-do │ ├── config │ │ └── watches.json │ ├── contend-leadership.py │ └── entrypoint ├── arcyd │ ├── arcyd-do │ ├── arcyd-dockerfile │ └── entrypoint ├── build-image.sh ├── gitdaemon │ ├── Dockerfile │ └── entrypoint ├── gituser │ ├── Dockerfile │ └── entrypoint └── phabricator │ ├── Dockerfile │ └── phab.conf ├── examples ├── README.md ├── arcyon │ ├── _check_requirements.sh │ ├── count_recent_reviews_per_period.sh │ ├── count_reviews_per_date.sh │ ├── count_reviews_per_day.sh │ ├── count_reviews_per_month.sh │ ├── count_reviews_per_week.sh │ ├── list_my_revs.sh │ ├── list_my_todo.sh │ ├── list_revisions_by_project.sh │ ├── list_top_authors.sh │ ├── list_waiting_on.sh │ ├── nudge_stale_waiting_on.sh │ └── phlint.sh └── phab-ping │ ├── ping_phabricator_actual.sh │ └── watch_instance_mail_on_fail.sh ├── gen_doc.sh ├── gen_test_plan.sh ├── integration_tests.sh ├── meta ├── autofix │ ├── fiximports.py │ └── fixlegal.py ├── compileall.sh ├── docgen │ ├── genmoddoc.py │ ├── updatemodcontents.py │ └── updatetestplan.py ├── install_devtools.sh ├── install_phabricator.sh ├── package_deps │ ├── .gitignore │ ├── check_no_dead_files.sh │ ├── expected-package-deps │ ├── install_snakefood.sh │ ├── make.sh │ └── process.py └── review_states │ ├── install_graphviz.sh │ ├── make.sh │ └── review_states.dot ├── precommit.sh ├── proto ├── arcyd ├── arcyd-tester ├── barc ├── conduit-proxy ├── git-phab-log └── linterate ├── py ├── README.md ├── abd │ ├── README.md │ ├── abdcmd_addphabricator.py │ ├── abdcmd_addrepo.py │ ├── abdcmd_addrepohost.py │ ├── abdcmd_arcyd.py │ ├── abdcmd_fetch.py │ ├── abdcmd_fsck.py │ ├── abdcmd_init.py │ ├── abdcmd_listrepos.py │ ├── abdcmd_reload.py │ ├── abdcmd_restart.py │ ├── abdcmd_rmrepo.py │ ├── abdcmd_start.py │ ├── abdcmd_stop.py │ ├── abdcmnt_commenter.py │ ├── abdi_processexitcodes.py │ ├── abdi_processrepo.py │ ├── abdi_processrepo__t.py │ ├── abdi_processrepoarglist.py │ ├── abdi_processrepos.py │ ├── abdi_repo.py │ ├── abdi_repoargs.py │ ├── abdi_startstop.py │ ├── abdmail_mailer.py │ ├── abdt_branch.py │ ├── abdt_branch__t.py │ ├── abdt_branchmock.py │ ├── abdt_branchmock__t.py │ ├── abdt_branchtester.py │ ├── abdt_classicnaming.py │ ├── abdt_classicnaming__t.py │ ├── abdt_compositenaming.py │ ├── abdt_compositenaming__t.py │ ├── abdt_conduit.py │ ├── abdt_conduit__it.py │ ├── abdt_conduitgit.py │ ├── abdt_conduitmock.py │ ├── abdt_conduitmock__t.py │ ├── abdt_differ.py │ ├── abdt_differ__t.py │ ├── abdt_differresultcache.py │ ├── abdt_differresultcache__t.py │ ├── abdt_errident.py │ ├── abdt_exception.py │ ├── abdt_exhandlers.py │ ├── abdt_fs.py │ ├── abdt_git.py │ ├── abdt_git__t.py │ ├── abdt_lander.py │ ├── abdt_landinglog.py │ ├── abdt_landinglog__t.py │ ├── abdt_logging.py │ ├── abdt_naming.py │ ├── abdt_naming__t.py │ ├── abdt_namingtester.py │ ├── abdt_rbranchnaming.py │ ├── abdt_rbranchnaming__t.py │ ├── abdt_tryloop.py │ └── abdt_userwarning.py ├── aon │ ├── README.md │ ├── aoncmd_arcyon.py │ ├── aoncmd_comment.py │ ├── aoncmd_commentinline.py │ ├── aoncmd_createrevision.py │ ├── aoncmd_getdiff.py │ ├── aoncmd_gitdiffhelper.py │ ├── aoncmd_paste.py │ ├── aoncmd_query.py │ ├── aoncmd_rawdiff.py │ ├── aoncmd_showconfig.py │ ├── aoncmd_taskcreate.py │ ├── aoncmd_taskquery.py │ ├── aoncmd_taskupdate.py │ └── aoncmd_updaterevision.py ├── ate │ ├── README.md │ ├── atecmd_arcydtester.py │ ├── atet_arcyd_instance.py │ ├── atet_arcyd_instance__it.py │ ├── atet_fixture.py │ ├── atet_sharedrepo.py │ └── atet_worker.py ├── bar │ ├── README.md │ ├── barcmd_barc.py │ ├── barcmd_gc.py │ └── barcmd_list.py ├── gab │ ├── README.md │ └── gabcmd_gitphablog.py ├── lor │ ├── README.md │ └── lorcmd_linterate.py ├── phl │ ├── README.md │ ├── phlcon_differential.py │ ├── phlcon_differential__it.py │ ├── phlcon_maniphest.py │ ├── phlcon_paste.py │ ├── phlcon_paste__it.py │ ├── phlcon_project.py │ ├── phlcon_remarkup.py │ ├── phlcon_reviewstatecache.py │ ├── phlcon_reviewstatecache__it.py │ ├── phlcon_user.py │ ├── phlcon_user__it.py │ ├── phldef_conduit.py │ ├── phlgit_branch.py │ ├── phlgit_checkout.py │ ├── phlgit_commit.py │ ├── phlgit_diff.py │ ├── phlgit_diff__t.py │ ├── phlgit_diffindex.py │ ├── phlgit_fetch.py │ ├── phlgit_fetch__t.py │ ├── phlgit_hashobject.py │ ├── phlgit_log.py │ ├── phlgit_log__t.py │ ├── phlgit_merge.py │ ├── phlgit_push.py │ ├── phlgit_rebase.py │ ├── phlgit_revlist.py │ ├── phlgit_revparse.py │ ├── phlgit_show.py │ ├── phlgit_showref.py │ ├── phlgitu_fixture.py │ ├── phlgitu_ref.py │ ├── phlgitx_ignoreattributes.py │ ├── phlgitx_ignoreattributes__t.py │ ├── phlgitx_refcache.py │ ├── phlmail_format.py │ ├── phlmail_mocksender.py │ ├── phlmail_mocksender__t.py │ ├── phlmail_sender.py │ ├── phlmp_cyclingpool.py │ ├── phlmp_cyclingpool__t.py │ ├── phlsys_arcconfig.py │ ├── phlsys_arcrc.py │ ├── phlsys_choice.py │ ├── phlsys_compiface.py │ ├── phlsys_compressedlogging.py │ ├── phlsys_compressedlogging__t.py │ ├── phlsys_conduit.py │ ├── phlsys_conduit__it.py │ ├── phlsys_cppcheck.py │ ├── phlsys_cppcheck__t.py │ ├── phlsys_daemonize.py │ ├── phlsys_daemonize__t.py │ ├── phlsys_dictutil.py │ ├── phlsys_dictutil__t.py │ ├── phlsys_fs.py │ ├── phlsys_git.py │ ├── phlsys_git__it.py │ ├── phlsys_makeconduit.py │ ├── phlsys_multiprocessing.py │ ├── phlsys_multiprocessing__t.py │ ├── phlsys_namedtuple.py │ ├── phlsys_namedtuple__t.py │ ├── phlsys_pid.py │ ├── phlsys_sendmail.py │ ├── phlsys_signal.py │ ├── phlsys_signal__t.py │ ├── phlsys_string.py │ ├── phlsys_strtotime.py │ ├── phlsys_subcommand.py │ ├── phlsys_subprocess.py │ ├── phlsys_subprocess__t.py │ ├── phlsys_textconvert.py │ ├── phlsys_textconvert__t.py │ ├── phlsys_timedeltatostr.py │ ├── phlsys_timer.py │ ├── phlsys_tracedecorator.py │ ├── phlsys_tryloop.py │ ├── phlsys_tryloop__t.py │ ├── phlsys_verboseerrorfilter.py │ ├── phlsys_verboseerrorfilter__t.py │ ├── phlsys_web.py │ ├── phlsys_web__t.py │ ├── phlsys_workingdircommand.py │ ├── phlsys_workingdircommand__t.py │ ├── phlurl_request.py │ ├── phlurl_request__t.py │ ├── phlurl_watcher.py │ └── phlurl_watcher__t.py ├── pig │ ├── README.md │ └── pigcmd_phabping.py └── pox │ ├── README.md │ └── poxcmd_conduitproxy.py ├── smoke_tests.sh ├── static_tests.sh ├── testbed ├── .arcconfig ├── .gitignore ├── arcyd-tester │ ├── git_fetch_counter_arcyd.py │ └── smoketest.sh ├── arcyd │ ├── _loop.sh │ ├── acceptance_tests.sh │ ├── arcydhelper │ ├── bad_git_push_arcyd.py │ ├── docker-cluster-test.sh │ ├── docker-testshell.sh │ ├── exercise_arcyd.sh │ ├── logerror │ ├── loop_test.sh │ ├── maily │ ├── poke_loop.sh │ ├── profile_arcyd.sh │ ├── run_maily.sh │ ├── savemail │ ├── savereport │ ├── savesystemerror.sh │ ├── test_shell.sh │ └── unreliable_git_loop_test.sh ├── arcyon │ ├── acceptance_tests.sh │ ├── diff1 │ ├── diff2 │ ├── exercise-query-parallel.sh │ ├── exercise-query-serial.sh │ └── exercise_arcyon.sh ├── barc │ └── smoketest.sh ├── conduit-proxy │ └── smoketest.sh ├── docker-phabricator │ └── run-docker-phab-web-mysql.sh ├── git-phab-log │ └── smoketest.sh ├── install-flake8.sh ├── install-mailcatcher.sh ├── install-nose.sh ├── linterate │ ├── hello_world.cpp │ ├── hello_world_bad.cpp │ └── put_hello_world_example.sh ├── lockfile │ ├── .gitignore │ ├── looping_writer.py │ ├── run_loopers.sh │ ├── run_singles.sh │ └── single_writer.py ├── phab-ping │ └── exercise_phabping.sh ├── phlsys_fs_atomic │ ├── file_writer │ └── test_file_writer ├── phlsys_signal │ ├── signal_receiver │ └── test_signal_receiver ├── reader-writer │ ├── .gitignore │ ├── reader.py │ ├── run.sh │ └── writer.py ├── singletest.sh └── threading │ └── thread-subprocess-test.py ├── unit_tests.sh └── vagrant ├── .gitignore ├── Vagrantfile ├── puppet-apply.sh ├── puppet └── phabricator │ ├── files │ └── initial.db │ ├── manifests │ └── default.pp │ └── templates │ └── vhost.erb └── vagrant-windows-msysgit-ssh.sh /.gitignore: -------------------------------------------------------------------------------- 1 | *.swp 2 | *.pyc 3 | tags 4 | .ropeproject 5 | .legcache 6 | .coverage 7 | .noseids 8 | package-deps 9 | file-deps 10 | deps 11 | .linteratecache 12 | .linteratenovelcache 13 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | 3 | language: python 4 | python: 5 | - "2.7" 6 | 7 | addons: 8 | apt: 9 | packages: 10 | - time 11 | 12 | install: 13 | # Install dependencies using pip 14 | - pip install autopep8 15 | - pip install docformatter 16 | - pip install flake8 17 | - pip install nose 18 | # TODO: Change this to 'pip install pycheker' once pycheker starts working 19 | # with pip. pip install of pycheker is broken at the moment. 20 | - pip install http://sourceforge.net/projects/pychecker/files/pychecker/0.8.19/pychecker-0.8.19.tar.gz/download 21 | - pip install pylint 22 | - pip install snakefood 23 | 24 | before_script: 25 | # This is necessary because Travis shallow clones the repo and we require the 26 | # entire log to run meta/autofix/fixlegal.py, we also require origin/master. 27 | - git fetch --unshallow 28 | - git config --global user.email travis@server.test 29 | - git config --global user.name Travis CI 30 | - git fetch origin master:refs/remotes/origin/master 31 | 32 | script: 33 | # Run code checks and tests while exclding those which require phabricator. 34 | - ./precommit.sh -e integration_tests -e smoke_tests 35 | -------------------------------------------------------------------------------- /CONTENTS.md: -------------------------------------------------------------------------------- 1 | Directory Layout 2 | ================ 3 | 4 | * `bin` - binaries for you 5 | * `examples` - examples and utils for using the binaries 6 | * `vagrant` - artifacts for creating an instant phabricator install 7 | 8 | Binaries for you 9 | ---------------- 10 | 11 | `bin` 12 | 13 | Here are all the end-products you might wish to use from this repository, 14 | it's probably most convienient to create a symbolic link to them or add 15 | the bin directory to $PATH. 16 | 17 | * `phab-ping` - a simple tool to check the responsiveness of your Phabricator 18 | * `arcyon` - a wrapper around Conduit API to aid scripting 19 | 20 | Each command comes with comprehensive help, available by passing the '--help' argument, e.g.: 21 | `$ arcyd --help` 22 | 23 | Examples for using the binaries 24 | ------------------------------- 25 | 26 | `examples` 27 | 28 | To make it easy to get started with the binaries, here are some scripts which 29 | illustrate usage examples and provide simple utilities. 30 | 31 | Artifacts for creating an instant phabricator install 32 | ----------------------------------------------------- 33 | 34 | `vagrant` 35 | 36 | Everything here depends on having an instance of Phabricator up and running; 37 | so it's important that we can have one up and running easily, these artifacts 38 | enable you to create a new instance of Phabricator in a single step using 39 | Vagrant and Puppet. 40 | 41 | Please see [README](https://github.com/bloomberg/phabricator-tools/blob/master/README.md#install-phabricator-in-one-step) 42 | for quickstart instructions. 43 | -------------------------------------------------------------------------------- /DCO.md: -------------------------------------------------------------------------------- 1 | Developer's Certificate of Origin 1.1 2 | 3 | By making a contribution to this project, I certify that: 4 | 5 | 1. The contribution was created in whole or in part by me and I 6 | have the right to submit it under the open source license 7 | indicated in the file; or 8 | 9 | 2. The contribution is based upon previous work that, to the best 10 | of my knowledge, is covered under an appropriate open source 11 | license and I have the right under that license to submit that 12 | work with modifications, whether created in whole or in part 13 | by me, under the same open source license (unless I am 14 | permitted to submit under a different license), as indicated 15 | in the file; or 16 | 17 | 3. The contribution was provided directly to me by some other 18 | person who certified (1), (2) or (3) and I have not modified 19 | it. 20 | 21 | 4. I understand and agree that this project and the contribution 22 | are public and that a record of the contribution (including all 23 | personal information I submit with it, including my sign-off) is 24 | maintained indefinitely and may be redistributed consistent with 25 | this project or the open source license(s) involved. 26 | 27 | -------------------------------------------------------------------------------- /bin/arcyon: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # encoding: utf-8 3 | 4 | import os 5 | import sys 6 | 7 | # The code base currently depends on version 2.7 of Python, any earlier 8 | # than that and it won't have the requisite argparse feaures. Any later 9 | # than that (3.x) and there are breaking changes in the syntax. 10 | # 11 | # Prevent nasty runtime surprises by enforcing version 2.7 as early as 12 | # possible. 13 | # 14 | # The version check itself will not work prior to Python version 2.0, 15 | # that's when sys.version_info was introduced. 16 | # 17 | if sys.version_info[:2] != (2, 7): 18 | sys.stderr.write("You need python 2.7 to run this script\n") 19 | exit(1) 20 | 21 | # append our module dirs to sys.path, which is the list of paths to search 22 | # for modules this is so we can import our libraries directly 23 | # N.B. this magic is only really passable up-front in the entrypoint module 24 | PARENT_DIR = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) 25 | sys.path.append(os.path.join(PARENT_DIR, "py", "aon")) 26 | sys.path.append(os.path.join(PARENT_DIR, "py", "phl")) 27 | # TODO: do not import from other tools 28 | sys.path.append(os.path.join(PARENT_DIR, "py", "abd")) 29 | 30 | # flake8 rightly complains about this, disable it with 'noqa' 31 | import aoncmd_arcyon # noqa 32 | 33 | if __name__ == "__main__": 34 | sys.exit(aoncmd_arcyon.main()) 35 | 36 | # ----------------------------------------------------------------------------- 37 | # Copyright (C) 2013-2015 Bloomberg Finance L.P. 38 | # 39 | # Licensed under the Apache License, Version 2.0 (the "License"); 40 | # you may not use this file except in compliance with the License. 41 | # You may obtain a copy of the License at 42 | # 43 | # http://www.apache.org/licenses/LICENSE-2.0 44 | # 45 | # Unless required by applicable law or agreed to in writing, software 46 | # distributed under the License is distributed on an "AS IS" BASIS, 47 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 48 | # See the License for the specific language governing permissions and 49 | # limitations under the License. 50 | # ------------------------------ END-OF-FILE ---------------------------------- 51 | -------------------------------------------------------------------------------- /bin/phab-ping: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # encoding: utf-8 3 | 4 | import os 5 | import sys 6 | 7 | # The code base currently depends on version 2.7 of Python, any earlier 8 | # than that and it won't have the requisite argparse feaures. Any later 9 | # than that (3.x) and there are breaking changes in the syntax. 10 | # 11 | # Prevent nasty runtime surprises by enforcing version 2.7 as early as 12 | # possible. 13 | # 14 | # The version check itself will not work prior to Python version 2.0, 15 | # that's when sys.version_info was introduced. 16 | # 17 | if sys.version_info[:2] != (2, 7): 18 | sys.stderr.write("You need python 2.7 to run this script\n") 19 | exit(1) 20 | 21 | # append our module dirs to sys.path, which is the list of paths to search 22 | # for modules this is so we can import our libraries directly 23 | # N.B. this magic is only really passable up-front in the entrypoint module 24 | PARENT_DIR = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) 25 | sys.path.append(os.path.join(PARENT_DIR, "py", "pig")) 26 | sys.path.append(os.path.join(PARENT_DIR, "py", "phl")) 27 | 28 | # flake8 rightly complains about this, disable it with 'noqa' 29 | import pigcmd_phabping # noqa 30 | 31 | if __name__ == "__main__": 32 | sys.exit(pigcmd_phabping.main()) 33 | 34 | # ----------------------------------------------------------------------------- 35 | # Copyright (C) 2013-2015 Bloomberg Finance L.P. 36 | # 37 | # Licensed under the Apache License, Version 2.0 (the "License"); 38 | # you may not use this file except in compliance with the License. 39 | # You may obtain a copy of the License at 40 | # 41 | # http://www.apache.org/licenses/LICENSE-2.0 42 | # 43 | # Unless required by applicable law or agreed to in writing, software 44 | # distributed under the License is distributed on an "AS IS" BASIS, 45 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 46 | # See the License for the specific language governing permissions and 47 | # limitations under the License. 48 | # ------------------------------ END-OF-FILE ---------------------------------- 49 | -------------------------------------------------------------------------------- /doc/man/arcyd/arcyd_add-phabricator.generated.txt: -------------------------------------------------------------------------------- 1 | usage: arcyd add-phabricator [-h] --name STR --instance-uri ADDRESS 2 | --arcyd-user USERNAME --arcyd-cert CERT 3 | [--review-url-format STRING] 4 | [--https-proxy PROXY] 5 | [--admin-emails [TO [TO ...]]] 6 | 7 | Make a new phabricator instance known to the Arcyd instance. 8 | 9 | optional arguments: 10 | -h, --help show this help message and exit 11 | --name STR string name of the phabricator instance, ^[_a-z0-9-]+$ 12 | --instance-uri ADDRESS 13 | URI to use to access the conduit API, e.g. 14 | 'http://127.0.0.1/api/'. 15 | --arcyd-user USERNAME 16 | username of admin account registered for arcyd to use. 17 | --arcyd-cert CERT Phabricator Conduit API certificate to use, this is 18 | the value that you will find in your user account in 19 | Phabricator at: 20 | http://your.server.example/settings/panel/conduit/. It 21 | can also be found in ~/.arcrc. 22 | --review-url-format STRING 23 | a format string for generating URLs for viewing 24 | reviews, e.g. something like this: 25 | 'http://my.phabricator/D{review}' , note that the 26 | {review} will be substituted for the id of the branch. 27 | --https-proxy PROXY proxy URI for arcyd to use when connecting to conduit 28 | on https. 29 | --admin-emails [TO [TO ...]] 30 | list of email addresses to send important repo events 31 | to 32 | -------------------------------------------------------------------------------- /doc/man/arcyd/arcyd_add-repo.generated.txt: -------------------------------------------------------------------------------- 1 | usage: arcyd add-repo [-h] [--name STR] [--repo-desc STR] 2 | [--admin-emails [TO [TO ...]]] 3 | phabricator_name repohost_name repo_url 4 | 5 | Add a new repository for the Arcyd instance to manage. 6 | 7 | positional arguments: 8 | phabricator_name name of the Phabricator instance associated with the 9 | repo. 10 | repohost_name name of the repohost associated with the repo. 11 | repo_url url to clone the repository, e.g. 'github:org/repo' or 12 | maybe something like 'org/repo' if using '--repo-url- 13 | format'. 14 | 15 | optional arguments: 16 | -h, --help show this help message and exit 17 | --name STR string identifier for the repository, '^[_a-z0-9-]+$'. 18 | will guess a name from the mandatory args if none 19 | provided. 20 | --repo-desc STR very short description of the repository, appears on 21 | the dashboard, in error messages and in logs. will 22 | guess a name from the mandatory args if none provided. 23 | --admin-emails [TO [TO ...]] 24 | list of email addresses to send important repo events 25 | to 26 | -------------------------------------------------------------------------------- /doc/man/arcyd/arcyd_fetch.generated.txt: -------------------------------------------------------------------------------- 1 | usage: arcyd fetch [-h] 2 | 3 | Fetch managed repos. 4 | 5 | optional arguments: 6 | -h, --help show this help message and exit 7 | 8 | This can be useful if you are switching from one arcyd instance to 9 | another, to 'pre-fetch' before actually moving over. 10 | -------------------------------------------------------------------------------- /doc/man/arcyd/arcyd_fsck.generated.txt: -------------------------------------------------------------------------------- 1 | usage: arcyd fsck [-h] [--repos [REPOS [REPOS ...]]] [--fix] [--remote] 2 | [--verbose] 3 | 4 | Check the Arcyd files for consistency and fix any issues. 5 | 6 | optional arguments: 7 | -h, --help show this help message and exit 8 | --repos [REPOS [REPOS ...]] 9 | an optional list of repository names to check. 10 | --fix resolve issues that are detected, where possible. 11 | --remote also check remote resources pointed to by the file 12 | system. e.g. git remotes. 13 | --verbose, -v verbose output. 14 | -------------------------------------------------------------------------------- /doc/man/arcyd/arcyd_init.generated.txt: -------------------------------------------------------------------------------- 1 | usage: arcyd init [-h] --arcyd-email EMAIL [--sendmail-binary PROGRAM] 2 | [--sendmail-type TYPE] [--sleep-secs TIME] 3 | [--external-report-command PATH] [--max-workers COUNT] 4 | [--sys-admin-emails ADDR [ADDR ...]] 5 | 6 | Create a new arcyd instance in working dir, with backing git repository. 7 | 8 | optional arguments: 9 | -h, --help show this help message and exit 10 | --arcyd-email EMAIL email address for arcyd to send messages from 11 | --sendmail-binary PROGRAM 12 | program to send the mail with (e.g. sendmail, 13 | catchmail) 14 | --sendmail-type TYPE type of program to send the mail with (sendmail, 15 | catchmail), this will affect the parameters that Arcyd 16 | will use. 17 | --sleep-secs TIME time to wait between runs through the list 18 | --external-report-command PATH 19 | path to an external reporter to send monitoring info 20 | to, will be called like so: $REPORTER <> 22 | --max-workers COUNT maximum number of worker processes to run at one time, 23 | Set to 0 to let Arcyd decide the number. Set to 1 to 24 | disable multiprocessing completely. 25 | --sys-admin-emails ADDR [ADDR ...] 26 | list of email address to send mail to on system error. 27 | -------------------------------------------------------------------------------- /doc/man/arcyd/arcyd_list-repos.generated.txt: -------------------------------------------------------------------------------- 1 | usage: arcyd list-repos [-h] [--only-formatted-repo-urls | --only-identifiers] 2 | 3 | List the repositories managed by this arcyd instance. 4 | 5 | optional arguments: 6 | -h, --help show this help message and exit 7 | --only-formatted-repo-urls 8 | --only-identifiers 9 | -------------------------------------------------------------------------------- /doc/man/arcyd/arcyd_rm-repo.generated.txt: -------------------------------------------------------------------------------- 1 | usage: arcyd rm-repo [-h] [--lookup-url] STR 2 | 3 | Remove a repository from the Arcyd instance. 4 | 5 | positional arguments: 6 | STR string identifier of the repository to remove. 7 | 8 | optional arguments: 9 | -h, --help show this help message and exit 10 | --lookup-url treat 'name' as a full url and lookup the associated 11 | repoconfig. Fail if there is more than one repo with the same 12 | url. 13 | -------------------------------------------------------------------------------- /doc/man/arcyd/arcyd_start.generated.txt: -------------------------------------------------------------------------------- 1 | usage: arcyd start [-h] [--foreground] [--no-loop] 2 | 3 | Start the arcyd instance for the current directory, if not already going. 4 | 5 | optional arguments: 6 | -h, --help show this help message and exit 7 | --foreground, -f supply this argument to run arcyd interactively in the 8 | foreground 9 | --no-loop supply this argument to only process each repo once then 10 | exit 11 | -------------------------------------------------------------------------------- /doc/man/arcyd/arcyd_stop.generated.txt: -------------------------------------------------------------------------------- 1 | usage: arcyd stop [-h] [-m MESSAGE] 2 | 3 | Stop the arcyd instance for the current directory. 4 | 5 | optional arguments: 6 | -h, --help show this help message and exit 7 | -m MESSAGE, --message MESSAGE 8 | reason for stopping arcyd 9 | -------------------------------------------------------------------------------- /doc/man/arcyon/arcyon_comment-inline.generated.txt: -------------------------------------------------------------------------------- 1 | usage: arcyon comment-inline [-h] [--message M] [--message-file FILE] 2 | --filepath FILE --start-line # 3 | [--end-line-offset #] [--left-side] 4 | [--uri ADDRESS] [--user NAME] [--cert HEX] 5 | [--act-as-user NAME] 6 | id 7 | 8 | create an inline comment on a differential review. 9 | 10 | positional arguments: 11 | id the revision id to comment on (e.g. 1) 12 | 13 | optional arguments: 14 | -h, --help show this help message and exit 15 | --message M, -m M the body text of the comment 16 | --message-file FILE a file to read the message from, use '-' for stdin 17 | --filepath FILE, -f FILE 18 | the filename of the file to comment on 19 | --start-line #, -s # starting line of the comment 20 | --end-line-offset #, -l # 21 | number of extra lines the comment should span, the 22 | default is 0meaning that the comment spans one line 23 | only. 24 | --left-side, -o comment on the left (old) side of the diff 25 | 26 | connection arguments: 27 | use these optional parameters to override settings present in your 28 | "~/.arcrc" or ".arcconfig" files 29 | 30 | --uri ADDRESS address of the phabricator instance to connect to. 31 | --user NAME name of the user to connect as. 32 | --cert HEX long certificate string of the user to connect as, you 33 | can find this string here: 34 | http://your.phabricator/settings/panel/conduit/. 35 | generally you wouldn't expect to enter this on the 36 | command-line and would make an ~/.arcrc file by using 37 | '$ arc install-certificate'. 38 | --act-as-user NAME name of the user to impersonate (admin only). 39 | 40 | Note: this will create the comments but not submit them. You must run 41 | arcyon comment with the --attach-inlines option in order to actually 42 | submit these. 43 | 44 | usage examples: 45 | comment on revision '1', file requestprocessor.py, starting on line 5, 46 | spanning 4 lines in total: 47 | $ arcyon comment-inline 1 -s 5 -l 3 --filepath requestprocessor.py 48 | -m 'hello revision 1, these four lines will leak memory, please fix' 49 | $ arcyon comment 1 --attach-inlines 50 | -------------------------------------------------------------------------------- /doc/man/arcyon/arcyon_comment.generated.txt: -------------------------------------------------------------------------------- 1 | usage: arcyon comment [-h] [--ids-file FILE] [--message M] 2 | [--message-file FILE] [--silent] [--attach-inlines] 3 | [--action ACTION] [--uri ADDRESS] [--user NAME] 4 | [--cert HEX] [--act-as-user NAME] 5 | [ids [ids ...]] 6 | 7 | create a comment on differential reviews. 8 | 9 | positional arguments: 10 | ids the revisions to comment on (e.g. 1) 11 | 12 | optional arguments: 13 | -h, --help show this help message and exit 14 | --ids-file FILE a file to read ids from, use '-' to specify stdin 15 | --message M, -m M the body text of the comment 16 | --message-file FILE a file to read the message from, use '-' for stdin 17 | --silent don't send notification emails for this comment 18 | --attach-inlines attach pending inline comments 19 | 20 | action arguments: 21 | use any of ['comment', 'unabandon', 'commandeer', 'request changes', 'accept', 22 | 'reopen', 'plan changes', 'request review', 'abandon', 'close', 23 | 'resign as reviewer'] 24 | 25 | --action ACTION, -a ACTION 26 | perform an action on a review 27 | 28 | connection arguments: 29 | use these optional parameters to override settings present in your 30 | "~/.arcrc" or ".arcconfig" files 31 | 32 | --uri ADDRESS address of the phabricator instance to connect to. 33 | --user NAME name of the user to connect as. 34 | --cert HEX long certificate string of the user to connect as, you 35 | can find this string here: 36 | http://your.phabricator/settings/panel/conduit/. 37 | generally you wouldn't expect to enter this on the 38 | command-line and would make an ~/.arcrc file by using 39 | '$ arc install-certificate'. 40 | --act-as-user NAME name of the user to impersonate (admin only). 41 | 42 | usage examples: 43 | comment on revision '1': 44 | $ arcyon comment 1 -m 'hello revision 1, how are you?' 45 | 46 | accept revision '1': 47 | $ arcyon comment 1 -m 'looks good' --action accept 48 | 49 | comment on revisions 1 and 2, reading the message from 'mymessage': 50 | $ arcyon comment 1 2 --message-file mymessage 51 | -------------------------------------------------------------------------------- /doc/man/arcyon/arcyon_inline-comment.generated.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bloomberg/phabricator-tools/09bd1587fe8945d93a891162fd4c89640c6fada7/doc/man/arcyon/arcyon_inline-comment.generated.txt -------------------------------------------------------------------------------- /doc/man/arcyon/arcyon_paste.generated.txt: -------------------------------------------------------------------------------- 1 | usage: arcyon paste [-h] (--text TEXT | --text-file FILENAME) 2 | [--language LANGUAGE] [--format-id] [--uri ADDRESS] 3 | [--user NAME] [--cert HEX] [--act-as-user NAME] 4 | title 5 | 6 | Create a new paste. 7 | 8 | positional arguments: 9 | title Title of the paste. 10 | 11 | optional arguments: 12 | -h, --help show this help message and exit 13 | --text TEXT, -t TEXT Text of the paste. 14 | --text-file FILENAME, -f FILENAME 15 | a file to read the paste from, use '-' to specify 16 | stdin 17 | --language LANGUAGE, -l LANGUAGE 18 | The language of the paste ie. C++, java etc. default 19 | detectsfrom filename in title. 20 | --format-id, --id only print the ID of the paste 21 | 22 | connection arguments: 23 | use these optional parameters to override settings present in your 24 | "~/.arcrc" or ".arcconfig" files 25 | 26 | --uri ADDRESS address of the phabricator instance to connect to. 27 | --user NAME name of the user to connect as. 28 | --cert HEX long certificate string of the user to connect as, you 29 | can find this string here: 30 | http://your.phabricator/settings/panel/conduit/. 31 | generally you wouldn't expect to enter this on the 32 | command-line and would make an ~/.arcrc file by using 33 | '$ arc install-certificate'. 34 | --act-as-user NAME name of the user to impersonate (admin only). 35 | 36 | Usage examples: 37 | Create a paste from an argument: 38 | $ arcyon paste "paste title" -t "This is a paste." 39 | https://your.phabricator.test/P1 40 | 41 | Create a paste from stdin: 42 | $ cat a_file | arcyon paste "paste title" -f - 43 | https://your.phabricator.test/P2 44 | 45 | Create a paste from file: 46 | $ arcyon paste "paste title" -f path/to/file 47 | https://your.phabricator.test/P3 48 | -------------------------------------------------------------------------------- /doc/man/arcyon/arcyon_raw-diff.generated.txt: -------------------------------------------------------------------------------- 1 | usage: arcyon raw-diff [-h] [--uri ADDRESS] [--user NAME] [--cert HEX] 2 | [--act-as-user NAME] 3 | [INFILE] 4 | 5 | Create a raw diff in differential. 6 | 7 | positional arguments: 8 | INFILE where to read the diff from, can be filename or '-' for 9 | stdin. default is stdin if not specified. 10 | 11 | optional arguments: 12 | -h, --help show this help message and exit 13 | 14 | connection arguments: 15 | use these optional parameters to override settings present in your 16 | "~/.arcrc" or ".arcconfig" files 17 | 18 | --uri ADDRESS address of the phabricator instance to connect to. 19 | --user NAME name of the user to connect as. 20 | --cert HEX long certificate string of the user to connect as, you 21 | can find this string here: 22 | http://your.phabricator/settings/panel/conduit/. 23 | generally you wouldn't expect to enter this on the 24 | command-line and would make an ~/.arcrc file by using '$ 25 | arc install-certificate'. 26 | --act-as-user NAME name of the user to impersonate (admin only). 27 | 28 | you can use the 'diff id' output from this command as input to the 29 | 'arcyon create-revision' and 'arcyon update-revision' commands. 30 | 31 | usage examples: 32 | create a new raw diff by piping in a diff: 33 | $ diff -u file1 file2 | arcyon raw-diff 34 | 99 35 | 36 | create a new raw diff by piping in a file: 37 | $ arcyon raw-diff < mydiff 38 | 99 39 | 40 | create a new raw diff by loading a file: 41 | $ arcyon raw-diff mydiff 42 | 99 43 | -------------------------------------------------------------------------------- /doc/man/arcyon/arcyon_show-config.generated.txt: -------------------------------------------------------------------------------- 1 | usage: arcyon show-config [-h] [--uri ADDRESS] [--user NAME] [--cert HEX] 2 | [--act-as-user NAME] 3 | 4 | show the configuration as discovered from the current directory. 5 | 6 | optional arguments: 7 | -h, --help show this help message and exit 8 | 9 | connection arguments: 10 | use these optional parameters to override settings present in your 11 | "~/.arcrc" or ".arcconfig" files 12 | 13 | --uri ADDRESS address of the phabricator instance to connect to. 14 | --user NAME name of the user to connect as. 15 | --cert HEX long certificate string of the user to connect as, you 16 | can find this string here: 17 | http://your.phabricator/settings/panel/conduit/. 18 | generally you wouldn't expect to enter this on the 19 | command-line and would make an ~/.arcrc file by using '$ 20 | arc install-certificate'. 21 | --act-as-user NAME name of the user to impersonate (admin only). 22 | -------------------------------------------------------------------------------- /doc/man/barc/barc.generated.txt: -------------------------------------------------------------------------------- 1 | usage: barc [-h] {gc,list} ... 2 | 3 | Barc - a command-line client to complement 'arcyd'. 4 | 5 | Essentially a prescriptive tool for supporting arcyd's branch-based workflow. 6 | 7 | positional arguments: 8 | {gc,list} 9 | gc DEPRECATED: Garbage collect in your local git repository. 10 | list List the reviews and corresponding branches in the current 11 | repository. 12 | 13 | optional arguments: 14 | -h, --help show this help message and exit 15 | 16 | usage example: 17 | Using the example accounts baked into the 'phabricator-tools' 18 | vagrant/puppet installation. (see ./README) 19 | 20 | to clean up landed local branches: 21 | $ barc gc --force --aggressive 22 | 23 | to display help on the 'gc' sub-command: 24 | $ barc gc --help 25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/man/barc/barc_list.generated.txt: -------------------------------------------------------------------------------- 1 | usage: barc list [-h] 2 | [--format-summary | --format-json | --format-python | --format-string STR] 3 | 4 | List the reviews and corresponding branches in the current repository. 5 | 6 | optional arguments: 7 | -h, --help show this help message and exit 8 | 9 | Output format parameters: 10 | Choose one only, default is "--format-summary" 11 | 12 | --format-summary list the review ids, statuses and review names. 13 | --format-json print json representation of managed review branches 14 | --format-python print python representation of managed review branches 15 | --format-string STR specify a custom format strings for displaying the 16 | items. the string will be applied using Python's 17 | str.format(), so you can use curly brackets to 18 | substitute for field names, e.g. "{review_id}". you can 19 | use "--format-python" to discover the field names. 20 | 21 | Usage examples: 22 | 23 | Summarise all the tracked review branches: 24 | $ barc list 25 | ID status tracked name 26 | 10596 ok r/master/linkUtil 27 | 10594 ok r/master/notification-spew 28 | 29 | List just the review ids and the trackers: 30 | $ barc list --format-string "{review_id} {remote_branch}" 31 | 10596 refs/remotes/origin/dev/arcyd/trackers/rbranch/--/-/ok/r/maste... 32 | 10594 refs/remotes/origin/dev/arcyd/trackers/rbranch/--/-/ok/r/maste... 33 | 34 | Output format examples: 35 | 36 | --format-summary 37 | ID status tracked name 38 | 10596 ok r/master/linkUtil 39 | 10594 ok r/master/notification-spew 40 | 41 | --format-json 42 | [ 43 | { 44 | "remote_base": "refs/remotes/origin/master", 45 | "review_id": "10596", 46 | ... 47 | } 48 | ... 49 | ] 50 | 51 | --format-python 52 | [ 53 | {"remote_base": "refs/remotes/origin/master", 54 | ... 55 | "review_id": "10596"}, 56 | ... 57 | ] 58 | -------------------------------------------------------------------------------- /docker/arcyd-cluster/arcyd-cluster-dockerfile: -------------------------------------------------------------------------------- 1 | FROM gliderlabs/consul-agent 2 | MAINTAINER Angelos Evripiotis 3 | RUN apk update && apk add python py-pip git 4 | RUN pip install requests 5 | COPY py /opt/phabricator-tools/py 6 | COPY proto/arcyd /opt/phabricator-tools/bin/arcyd 7 | COPY docker/arcyd-cluster/entrypoint /bin/entrypoint 8 | COPY docker/arcyd-cluster/arcyd-do /bin/arcyd-do 9 | COPY docker/arcyd-cluster/contend-leadership.py /bin/contend-leadership.py 10 | COPY docker/arcyd-cluster/config/ /config 11 | ENV ARCYD_EMAIL arcyd@localhost.invalid 12 | ENV ARCYD_NAME Arcyd 13 | ENV ARCYD_SLEEP_SECS 3 14 | RUN ln -s /opt/phabricator-tools/bin/arcyd /usr/bin/arcyd 15 | ENTRYPOINT ["/bin/entrypoint"] 16 | # ----------------------------------------------------------------------------- 17 | # Copyright (C) 2015-2016 Bloomberg Finance L.P. 18 | # 19 | # Licensed under the Apache License, Version 2.0 (the "License"); 20 | # you may not use this file except in compliance with the License. 21 | # You may obtain a copy of the License at 22 | # 23 | # http://www.apache.org/licenses/LICENSE-2.0 24 | # 25 | # Unless required by applicable law or agreed to in writing, software 26 | # distributed under the License is distributed on an "AS IS" BASIS, 27 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 28 | # See the License for the specific language governing permissions and 29 | # limitations under the License. 30 | # ------------------------------ END-OF-FILE ---------------------------------- 31 | -------------------------------------------------------------------------------- /docker/arcyd-cluster/arcyd-do: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | cd /var/arcyd 3 | arcyd $@ 4 | # ----------------------------------------------------------------------------- 5 | # Copyright (C) 2013-2015 Bloomberg Finance L.P. 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | # ------------------------------ END-OF-FILE ---------------------------------- 19 | -------------------------------------------------------------------------------- /docker/arcyd-cluster/config/watches.json: -------------------------------------------------------------------------------- 1 | { 2 | "watches": [ 3 | { 4 | "type": "key", 5 | "key": "arcyd/leader", 6 | "handler": "/bin/contend-leadership.py" 7 | } 8 | ] 9 | } 10 | # ----------------------------------------------------------------------------- 11 | # Copyright (C) 2015 Bloomberg Finance L.P. 12 | # 13 | # Licensed under the Apache License, Version 2.0 (the "License"); 14 | # you may not use this file except in compliance with the License. 15 | # You may obtain a copy of the License at 16 | # 17 | # http://www.apache.org/licenses/LICENSE-2.0 18 | # 19 | # Unless required by applicable law or agreed to in writing, software 20 | # distributed under the License is distributed on an "AS IS" BASIS, 21 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | # See the License for the specific language governing permissions and 23 | # limitations under the License. 24 | # ------------------------------ END-OF-FILE ---------------------------------- 25 | -------------------------------------------------------------------------------- /docker/arcyd-cluster/entrypoint: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | if [[ "$#" != 2 ]]; then 3 | echo "Usage: $0 REPO_URL CONSUL_SERVER" >&2 4 | exit 1 5 | fi 6 | REPO_URL=$1 7 | CONSUL_SERVER=$2 8 | if [ ! -d /var/arcyd ]; then 9 | cd /var 10 | git clone $REPO_URL arcyd 11 | git config --global user.email ${ARCYD_EMAIL} 12 | git config --global user.name ${ARCYD_NAME} 13 | cd arcyd 14 | if [ ! -f configfile ]; then 15 | arcyd init \ 16 | --arcyd-email ${ARCYD_EMAIL} \ 17 | --sleep-secs ${ARCYD_SLEEP_SECS} 18 | git push origin master 19 | else 20 | arcyd fsck --fix 21 | fi 22 | fi 23 | touch /var/arcyd/var/log/info 24 | touch /var/log/contend-leadership 25 | touch /var/log/consul-agent 26 | cd /var/arcyd 27 | tail -F /var/arcyd/var/log/info /var/log/contend-leadership /var/log/consul-agent & 28 | consul agent -config-dir /config -join ${CONSUL_SERVER} > /var/log/consul-agent 2>&1 & 29 | wait 30 | # ----------------------------------------------------------------------------- 31 | # Copyright (C) 2015 Bloomberg Finance L.P. 32 | # 33 | # Licensed under the Apache License, Version 2.0 (the "License"); 34 | # you may not use this file except in compliance with the License. 35 | # You may obtain a copy of the License at 36 | # 37 | # http://www.apache.org/licenses/LICENSE-2.0 38 | # 39 | # Unless required by applicable law or agreed to in writing, software 40 | # distributed under the License is distributed on an "AS IS" BASIS, 41 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 42 | # See the License for the specific language governing permissions and 43 | # limitations under the License. 44 | # ------------------------------ END-OF-FILE ---------------------------------- 45 | -------------------------------------------------------------------------------- /docker/arcyd/arcyd-do: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | cd /var/arcyd 3 | arcyd $@ 4 | # ----------------------------------------------------------------------------- 5 | # Copyright (C) 2013-2015 Bloomberg Finance L.P. 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | # ------------------------------ END-OF-FILE ---------------------------------- 19 | -------------------------------------------------------------------------------- /docker/arcyd/arcyd-dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine 2 | MAINTAINER Angelos Evripiotis 3 | RUN apk update && apk add python python3 git openssh-client 4 | COPY py /opt/phabricator-tools/py 5 | COPY proto/arcyd /opt/phabricator-tools/bin/arcyd 6 | COPY docker/arcyd/entrypoint /bin/entrypoint 7 | COPY docker/arcyd/arcyd-do /bin/arcyd-do 8 | ENV ARCYD_EMAIL arcyd@localhost.invalid 9 | ENV ARCYD_NAME Arcyd 10 | ENV ARCYD_SLEEP_SECS 3 11 | RUN ln -s /opt/phabricator-tools/bin/arcyd /usr/bin/arcyd 12 | ENTRYPOINT ["/bin/entrypoint"] 13 | # ----------------------------------------------------------------------------- 14 | # Copyright (C) 2015-2016 Bloomberg Finance L.P. 15 | # 16 | # Licensed under the Apache License, Version 2.0 (the "License"); 17 | # you may not use this file except in compliance with the License. 18 | # You may obtain a copy of the License at 19 | # 20 | # http://www.apache.org/licenses/LICENSE-2.0 21 | # 22 | # Unless required by applicable law or agreed to in writing, software 23 | # distributed under the License is distributed on an "AS IS" BASIS, 24 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | # See the License for the specific language governing permissions and 26 | # limitations under the License. 27 | # ------------------------------ END-OF-FILE ---------------------------------- 28 | -------------------------------------------------------------------------------- /docker/build-image.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | set -euo pipefail 3 | THIS_DIR=$(cd $(dirname $0); pwd -P) 4 | echo ${THIS_DIR} 5 | BUILD_DIR=$(mktemp -d /tmp/temp.XXXXX) 6 | 7 | cp "$1" "${BUILD_DIR}/Dockerfile" 8 | 9 | pushd ${BUILD_DIR} 10 | cp -R "${THIS_DIR}/.." . 11 | docker build -t "$2" . 12 | popd 13 | 14 | rm -rf ${BUILD_DIR} 15 | # ----------------------------------------------------------------------------- 16 | # Copyright (C) 2015-2016 Bloomberg Finance L.P. 17 | # 18 | # Licensed under the Apache License, Version 2.0 (the "License"); 19 | # you may not use this file except in compliance with the License. 20 | # You may obtain a copy of the License at 21 | # 22 | # http://www.apache.org/licenses/LICENSE-2.0 23 | # 24 | # Unless required by applicable law or agreed to in writing, software 25 | # distributed under the License is distributed on an "AS IS" BASIS, 26 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 27 | # See the License for the specific language governing permissions and 28 | # limitations under the License. 29 | # ------------------------------ END-OF-FILE ---------------------------------- 30 | -------------------------------------------------------------------------------- /docker/gitdaemon/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine 2 | MAINTAINER Angelos Evripiotis 3 | EXPOSE 9418 4 | RUN apk update && apk add git-daemon 5 | RUN mkdir /var/data 6 | COPY entrypoint /bin/entrypoint 7 | ENTRYPOINT ["/bin/entrypoint"] 8 | # ----------------------------------------------------------------------------- 9 | # Copyright (C) 2015 Bloomberg Finance L.P. 10 | # 11 | # Licensed under the Apache License, Version 2.0 (the "License"); 12 | # you may not use this file except in compliance with the License. 13 | # You may obtain a copy of the License at 14 | # 15 | # http://www.apache.org/licenses/LICENSE-2.0 16 | # 17 | # Unless required by applicable law or agreed to in writing, software 18 | # distributed under the License is distributed on an "AS IS" BASIS, 19 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | # See the License for the specific language governing permissions and 21 | # limitations under the License. 22 | # ------------------------------ END-OF-FILE ---------------------------------- 23 | -------------------------------------------------------------------------------- /docker/gitdaemon/entrypoint: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | set -x 3 | mkdir -p /data/git 4 | cd /data/git 5 | echo $@ 6 | for dir in $@; do 7 | git init --bare $dir 8 | done 9 | git daemon --verbose --reuseaddr --export-all --base-path=/data/git --enable=receive-pack /data/git 10 | # ----------------------------------------------------------------------------- 11 | # Copyright (C) 2015 Bloomberg Finance L.P. 12 | # 13 | # Licensed under the Apache License, Version 2.0 (the "License"); 14 | # you may not use this file except in compliance with the License. 15 | # You may obtain a copy of the License at 16 | # 17 | # http://www.apache.org/licenses/LICENSE-2.0 18 | # 19 | # Unless required by applicable law or agreed to in writing, software 20 | # distributed under the License is distributed on an "AS IS" BASIS, 21 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | # See the License for the specific language governing permissions and 23 | # limitations under the License. 24 | # ------------------------------ END-OF-FILE ---------------------------------- 25 | -------------------------------------------------------------------------------- /docker/gituser/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine 2 | MAINTAINER Angelos Evripiotis 3 | EXPOSE 9418 4 | ENV GITUSER_EMAIL gituser@localhost.invalid 5 | ENV GITUSER_NAME gituser 6 | RUN apk update && apk add git 7 | COPY entrypoint /bin/entrypoint 8 | ENTRYPOINT ["/bin/entrypoint"] 9 | # ----------------------------------------------------------------------------- 10 | # Copyright (C) 2015 Bloomberg Finance L.P. 11 | # 12 | # Licensed under the Apache License, Version 2.0 (the "License"); 13 | # you may not use this file except in compliance with the License. 14 | # You may obtain a copy of the License at 15 | # 16 | # http://www.apache.org/licenses/LICENSE-2.0 17 | # 18 | # Unless required by applicable law or agreed to in writing, software 19 | # distributed under the License is distributed on an "AS IS" BASIS, 20 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | # See the License for the specific language governing permissions and 22 | # limitations under the License. 23 | # ------------------------------ END-OF-FILE ---------------------------------- 24 | -------------------------------------------------------------------------------- /docker/gituser/entrypoint: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | set -x 3 | git config --global user.email "${GITUSER_EMAIL}" 4 | git config --global user.name "${GITUSER_NAME}" 5 | mkdir -p /data/git 6 | cd /data/git 7 | if [[ "$#" != 0 ]]; then 8 | git clone $@ 9 | fi 10 | sh 11 | # ----------------------------------------------------------------------------- 12 | # Copyright (C) 2015 Bloomberg Finance L.P. 13 | # 14 | # Licensed under the Apache License, Version 2.0 (the "License"); 15 | # you may not use this file except in compliance with the License. 16 | # You may obtain a copy of the License at 17 | # 18 | # http://www.apache.org/licenses/LICENSE-2.0 19 | # 20 | # Unless required by applicable law or agreed to in writing, software 21 | # distributed under the License is distributed on an "AS IS" BASIS, 22 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23 | # See the License for the specific language governing permissions and 24 | # limitations under the License. 25 | # ------------------------------ END-OF-FILE ---------------------------------- 26 | -------------------------------------------------------------------------------- /docker/phabricator/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:14.04 2 | MAINTAINER Angelos Evripiotis 3 | EXPOSE 80 4 | RUN apt-get update && apt-get install -y \ 5 | git \ 6 | php5 \ 7 | php5-mysql \ 8 | php5-gd \ 9 | php5-dev \ 10 | php5-curl \ 11 | php-apc \ 12 | php5-cli \ 13 | apache2 14 | RUN mkdir -p /phabricator/instances/dev 15 | RUN git clone https://github.com/phacility/phabricator /phabricator/instances/dev/phabricator 16 | RUN git clone https://github.com/phacility/libphutil /phabricator/instances/dev/libphutil 17 | RUN git clone https://github.com/phacility/arcanist /phabricator/instances/dev/arcanist 18 | RUN git -C /phabricator/instances/dev/phabricator reset --hard d13a3225634c47cf2e55b94199a0f2aba37aa293 19 | RUN git -C /phabricator/instances/dev/libphutil reset --hard 0b9f193303dfae4f9204d8f577e2bd45acd4963f 20 | RUN git -C /phabricator/instances/dev/arcanist reset --hard 6270dd0de5073931f3c3e75ab77f0f1d5fa77eef 21 | COPY phab.conf /etc/apache2/sites-available/phab.conf 22 | RUN ln -s /etc/apache2/sites-available/phab.conf /etc/apache2/sites-enabled/phab.conf 23 | RUN rm /etc/apache2/sites-enabled/000-default.conf 24 | RUN /usr/sbin/a2enmod rewrite 25 | CMD /usr/sbin/apache2ctl -D FOREGROUND 26 | # ----------------------------------------------------------------------------- 27 | # Copyright (C) 2016 Bloomberg Finance L.P. 28 | # 29 | # Licensed under the Apache License, Version 2.0 (the "License"); 30 | # you may not use this file except in compliance with the License. 31 | # You may obtain a copy of the License at 32 | # 33 | # http://www.apache.org/licenses/LICENSE-2.0 34 | # 35 | # Unless required by applicable law or agreed to in writing, software 36 | # distributed under the License is distributed on an "AS IS" BASIS, 37 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 38 | # See the License for the specific language governing permissions and 39 | # limitations under the License. 40 | # ------------------------------ END-OF-FILE ---------------------------------- 41 | -------------------------------------------------------------------------------- /docker/phabricator/phab.conf: -------------------------------------------------------------------------------- 1 | 2 | ServerName localhost 3 | 4 | DocumentRoot /phabricator/instances/dev/phabricator/webroot 5 | 6 | Options Indexes FollowSymLinks 7 | AllowOverride None 8 | Require all granted 9 | 10 | 11 | RewriteEngine on 12 | RewriteRule ^/rsrc/(.*) - [L,QSA] 13 | RewriteRule ^/favicon.ico - [L,QSA] 14 | RewriteRule ^(.*)$ /index.php?__path__=$1 [B,L,QSA] 15 | 16 | SetEnv PHABRICATOR_ENV production 17 | 18 | # ----------------------------------------------------------------------------- 19 | # Copyright (C) 2016 Bloomberg Finance L.P. 20 | # 21 | # Licensed under the Apache License, Version 2.0 (the "License"); 22 | # you may not use this file except in compliance with the License. 23 | # You may obtain a copy of the License at 24 | # 25 | # http://www.apache.org/licenses/LICENSE-2.0 26 | # 27 | # Unless required by applicable law or agreed to in writing, software 28 | # distributed under the License is distributed on an "AS IS" BASIS, 29 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 30 | # See the License for the specific language governing permissions and 31 | # limitations under the License. 32 | # ------------------------------ END-OF-FILE ---------------------------------- 33 | -------------------------------------------------------------------------------- /examples/arcyon/_check_requirements.sh: -------------------------------------------------------------------------------- 1 | # Check the requirements for the other examples to be able to run 2 | 3 | # make sure that the arcyon binary can be found 4 | find_binary=$(which arcyon) 5 | if [[ $? != 0 ]] ; then 6 | echo could not find arcyon binary, please add it to your '$PATH' 7 | echo 8 | echo [FAILED] 9 | exit 1 10 | else 11 | echo found arcyon: 12 | echo $find_binary 13 | fi 14 | 15 | echo 16 | 17 | # let 'arcyon show-config' determine if the configuration is sufficient 18 | # it will print helpful error messages if not and exit non-zero 19 | trap 'echo;echo [FAILED]; exit 1' ERR 20 | arcyon show-config "$@" 21 | 22 | echo 23 | echo [OK] 24 | # ----------------------------------------------------------------------------- 25 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 26 | # 27 | # Licensed under the Apache License, Version 2.0 (the "License"); 28 | # you may not use this file except in compliance with the License. 29 | # You may obtain a copy of the License at 30 | # 31 | # http://www.apache.org/licenses/LICENSE-2.0 32 | # 33 | # Unless required by applicable law or agreed to in writing, software 34 | # distributed under the License is distributed on an "AS IS" BASIS, 35 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 36 | # See the License for the specific language governing permissions and 37 | # limitations under the License. 38 | # ------------------------------ END-OF-FILE ---------------------------------- 39 | -------------------------------------------------------------------------------- /examples/arcyon/count_recent_reviews_per_period.sh: -------------------------------------------------------------------------------- 1 | # exit with error message if anything returns error status 2 | trap 'echo FAILED; exit 1' ERR 3 | 4 | echo "last update time" 5 | tempfile=`mktemp` 6 | arcyon query "$@" --format-string '$humanTimeSinceDateModified' --max-results 2000 > $tempfile 7 | arcyon query "$@" --format-string '$humanTimeSinceDateModified' --max-results 2000 --offset-results 2000 >> $tempfile 8 | arcyon query "$@" --format-string '$humanTimeSinceDateModified' --max-results 2000 --offset-results 4000 >> $tempfile 9 | arcyon query "$@" --format-string '$humanTimeSinceDateModified' --max-results 2000 --offset-results 6000 >> $tempfile 10 | arcyon query "$@" --format-string '$humanTimeSinceDateModified' --max-results 2000 --offset-results 8000 >> $tempfile 11 | 12 | uniq -c $tempfile 13 | echo `wc -l < $tempfile` reviews considered 14 | echo "(n.b. counts up to last 10,000 reviews or so only)" 15 | rm $tempfile 16 | # ----------------------------------------------------------------------------- 17 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 18 | # 19 | # Licensed under the Apache License, Version 2.0 (the "License"); 20 | # you may not use this file except in compliance with the License. 21 | # You may obtain a copy of the License at 22 | # 23 | # http://www.apache.org/licenses/LICENSE-2.0 24 | # 25 | # Unless required by applicable law or agreed to in writing, software 26 | # distributed under the License is distributed on an "AS IS" BASIS, 27 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 28 | # See the License for the specific language governing permissions and 29 | # limitations under the License. 30 | # ------------------------------ END-OF-FILE ---------------------------------- 31 | -------------------------------------------------------------------------------- /examples/arcyon/count_reviews_per_date.sh: -------------------------------------------------------------------------------- 1 | # exit with error message if anything returns error status 2 | trap 'echo FAILED; exit 1' ERR 3 | 4 | tempfile=`mktemp` 5 | arcyon query "$@" --format-string '$humanDateModified' --max-results 2000 > $tempfile 6 | arcyon query "$@" --format-string '$humanDateModified' --max-results 2000 --offset-results 2000 >> $tempfile 7 | arcyon query "$@" --format-string '$humanDateModified' --max-results 2000 --offset-results 4000 >> $tempfile 8 | arcyon query "$@" --format-string '$humanDateModified' --max-results 2000 --offset-results 6000 >> $tempfile 9 | arcyon query "$@" --format-string '$humanDateModified' --max-results 2000 --offset-results 8000 >> $tempfile 10 | 11 | echo "last update time, counts per date:" 12 | cut -f 1 -d' ' $tempfile | uniq -c 13 | 14 | echo 15 | echo "counts per month:" 16 | cut -f 1,2 -d'-' $tempfile | uniq -c 17 | 18 | echo 19 | echo `wc -l < $tempfile` reviews considered 20 | echo "(n.b. counts up to last 10,000 reviews or so only)" 21 | rm $tempfile 22 | # ----------------------------------------------------------------------------- 23 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 24 | # 25 | # Licensed under the Apache License, Version 2.0 (the "License"); 26 | # you may not use this file except in compliance with the License. 27 | # You may obtain a copy of the License at 28 | # 29 | # http://www.apache.org/licenses/LICENSE-2.0 30 | # 31 | # Unless required by applicable law or agreed to in writing, software 32 | # distributed under the License is distributed on an "AS IS" BASIS, 33 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 34 | # See the License for the specific language governing permissions and 35 | # limitations under the License. 36 | # ------------------------------ END-OF-FILE ---------------------------------- 37 | -------------------------------------------------------------------------------- /examples/arcyon/count_reviews_per_day.sh: -------------------------------------------------------------------------------- 1 | # exit with error message if anything returns error status 2 | trap 'echo FAILED; exit 1' ERR 3 | 4 | echo "last update time, counts per day:" 5 | echo 6 | tempfile=`mktemp` 7 | 8 | arcyon query "$@" --format-string '$daysSinceDateModified' --max-results 2000 > $tempfile 9 | arcyon query "$@" --format-string '$daysSinceDateModified' --max-results 2000 --offset-results 2000 >> $tempfile 10 | arcyon query "$@" --format-string '$daysSinceDateModified' --max-results 2000 --offset-results 4000 >> $tempfile 11 | arcyon query "$@" --format-string '$daysSinceDateModified' --max-results 2000 --offset-results 6000 >> $tempfile 12 | arcyon query "$@" --format-string '$daysSinceDateModified' --max-results 2000 --offset-results 8000 >> $tempfile 13 | 14 | uniq -c $tempfile 15 | echo `wc -l < $tempfile` reviews considered 16 | echo "(n.b. counts up to last 10,000 reviews or so only)" 17 | rm $tempfile 18 | # ----------------------------------------------------------------------------- 19 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 20 | # 21 | # Licensed under the Apache License, Version 2.0 (the "License"); 22 | # you may not use this file except in compliance with the License. 23 | # You may obtain a copy of the License at 24 | # 25 | # http://www.apache.org/licenses/LICENSE-2.0 26 | # 27 | # Unless required by applicable law or agreed to in writing, software 28 | # distributed under the License is distributed on an "AS IS" BASIS, 29 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 30 | # See the License for the specific language governing permissions and 31 | # limitations under the License. 32 | # ------------------------------ END-OF-FILE ---------------------------------- 33 | -------------------------------------------------------------------------------- /examples/arcyon/count_reviews_per_month.sh: -------------------------------------------------------------------------------- 1 | # exit with error message if anything returns error status 2 | trap 'echo FAILED; exit 1' ERR 3 | 4 | echo "last update time, counts per month:" 5 | echo 6 | tempfile=`mktemp` 7 | 8 | arcyon query "$@" --format-string '$monthsSinceDateModified' --max-results 2000 > $tempfile 9 | arcyon query "$@" --format-string '$monthsSinceDateModified' --max-results 2000 --offset-results 2000 >> $tempfile 10 | arcyon query "$@" --format-string '$monthsSinceDateModified' --max-results 2000 --offset-results 4000 >> $tempfile 11 | arcyon query "$@" --format-string '$monthsSinceDateModified' --max-results 2000 --offset-results 6000 >> $tempfile 12 | arcyon query "$@" --format-string '$monthsSinceDateModified' --max-results 2000 --offset-results 8000 >> $tempfile 13 | 14 | uniq -c $tempfile 15 | echo `wc -l < $tempfile` reviews considered 16 | echo "(n.b. counts up to last 10,000 reviews or so only)" 17 | rm $tempfile 18 | # ----------------------------------------------------------------------------- 19 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 20 | # 21 | # Licensed under the Apache License, Version 2.0 (the "License"); 22 | # you may not use this file except in compliance with the License. 23 | # You may obtain a copy of the License at 24 | # 25 | # http://www.apache.org/licenses/LICENSE-2.0 26 | # 27 | # Unless required by applicable law or agreed to in writing, software 28 | # distributed under the License is distributed on an "AS IS" BASIS, 29 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 30 | # See the License for the specific language governing permissions and 31 | # limitations under the License. 32 | # ------------------------------ END-OF-FILE ---------------------------------- 33 | -------------------------------------------------------------------------------- /examples/arcyon/count_reviews_per_week.sh: -------------------------------------------------------------------------------- 1 | # exit with error message if anything returns error status 2 | trap 'echo FAILED; exit 1' ERR 3 | 4 | echo "last update time, counts per week:" 5 | echo 6 | tempfile=`mktemp` 7 | 8 | arcyon query "$@" --format-string '$weeksSinceDateModified' --max-results 2000 > $tempfile 9 | arcyon query "$@" --format-string '$weeksSinceDateModified' --max-results 2000 --offset-results 2000 >> $tempfile 10 | arcyon query "$@" --format-string '$weeksSinceDateModified' --max-results 2000 --offset-results 4000 >> $tempfile 11 | arcyon query "$@" --format-string '$weeksSinceDateModified' --max-results 2000 --offset-results 6000 >> $tempfile 12 | arcyon query "$@" --format-string '$weeksSinceDateModified' --max-results 2000 --offset-results 8000 >> $tempfile 13 | 14 | uniq -c $tempfile 15 | echo `wc -l < $tempfile` reviews considered 16 | echo "(n.b. counts up to last 10,000 reviews or so only)" 17 | rm $tempfile 18 | # ----------------------------------------------------------------------------- 19 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 20 | # 21 | # Licensed under the Apache License, Version 2.0 (the "License"); 22 | # you may not use this file except in compliance with the License. 23 | # You may obtain a copy of the License at 24 | # 25 | # http://www.apache.org/licenses/LICENSE-2.0 26 | # 27 | # Unless required by applicable law or agreed to in writing, software 28 | # distributed under the License is distributed on an "AS IS" BASIS, 29 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 30 | # See the License for the specific language governing permissions and 31 | # limitations under the License. 32 | # ------------------------------ END-OF-FILE ---------------------------------- 33 | -------------------------------------------------------------------------------- /examples/arcyon/list_my_revs.sh: -------------------------------------------------------------------------------- 1 | # exit with error message if anything returns error status 2 | trap 'echo FAILED; exit 1' ERR 3 | 4 | echo Open reviews where you are the author: 5 | arcyon query "$@" --author-me --status-type open 6 | 7 | echo 8 | 9 | echo Open reviews where you are a reviewer: 10 | arcyon query "$@" --reviewer-me --status-type open 11 | # ----------------------------------------------------------------------------- 12 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 13 | # 14 | # Licensed under the Apache License, Version 2.0 (the "License"); 15 | # you may not use this file except in compliance with the License. 16 | # You may obtain a copy of the License at 17 | # 18 | # http://www.apache.org/licenses/LICENSE-2.0 19 | # 20 | # Unless required by applicable law or agreed to in writing, software 21 | # distributed under the License is distributed on an "AS IS" BASIS, 22 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23 | # See the License for the specific language governing permissions and 24 | # limitations under the License. 25 | # ------------------------------ END-OF-FILE ---------------------------------- 26 | -------------------------------------------------------------------------------- /examples/arcyon/list_my_todo.sh: -------------------------------------------------------------------------------- 1 | # List out the revisions that require the user to act next. 2 | 3 | # exit with error message if anything returns error status 4 | trap 'echo FAILED; exit 1' ERR 5 | 6 | #TODO: echo Your revisions in review with no reviewers: 7 | #TODO: $arcyon query --author-me --no-reviewers --status-type open --statuses 'Needs Review' 8 | 9 | echo Revisions you have authored: 10 | arcyon query "$@" --author-me --status-type open --statuses Accepted 'Needs Revision' 11 | 12 | echo 13 | 14 | echo Revisions you are reviewing: 15 | arcyon query "$@" --reviewer-me --status-type open --statuses 'Needs Review' 16 | # ----------------------------------------------------------------------------- 17 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 18 | # 19 | # Licensed under the Apache License, Version 2.0 (the "License"); 20 | # you may not use this file except in compliance with the License. 21 | # You may obtain a copy of the License at 22 | # 23 | # http://www.apache.org/licenses/LICENSE-2.0 24 | # 25 | # Unless required by applicable law or agreed to in writing, software 26 | # distributed under the License is distributed on an "AS IS" BASIS, 27 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 28 | # See the License for the specific language governing permissions and 29 | # limitations under the License. 30 | # ------------------------------ END-OF-FILE ---------------------------------- 31 | -------------------------------------------------------------------------------- /examples/arcyon/list_revisions_by_project.sh: -------------------------------------------------------------------------------- 1 | # exit with error message if anything returns error status 2 | trap 'echo FAILED; exit 1' ERR 3 | 4 | # print out "{projectName} {id}" for each open revision by projectName 5 | # use '$ arcyon query --arcanist-projects' to filter by project 6 | arcyon query "$@" --status-type open --format-type ids | xargs -I ID arcyon get-diff -r ID "$@" --format-string "{projectName} {id}" "" 7 | # ----------------------------------------------------------------------------- 8 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 9 | # 10 | # Licensed under the Apache License, Version 2.0 (the "License"); 11 | # you may not use this file except in compliance with the License. 12 | # You may obtain a copy of the License at 13 | # 14 | # http://www.apache.org/licenses/LICENSE-2.0 15 | # 16 | # Unless required by applicable law or agreed to in writing, software 17 | # distributed under the License is distributed on an "AS IS" BASIS, 18 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | # See the License for the specific language governing permissions and 20 | # limitations under the License. 21 | # ------------------------------ END-OF-FILE ---------------------------------- 22 | -------------------------------------------------------------------------------- /examples/arcyon/list_top_authors.sh: -------------------------------------------------------------------------------- 1 | # exit with error message if anything returns error status 2 | trap 'echo FAILED; exit 1' ERR 3 | 4 | arcyon query "$@" --translate --format-string '$authorUsername' | sort | uniq -c | sort -rn | head 5 | # ----------------------------------------------------------------------------- 6 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 7 | # 8 | # Licensed under the Apache License, Version 2.0 (the "License"); 9 | # you may not use this file except in compliance with the License. 10 | # You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | # ------------------------------ END-OF-FILE ---------------------------------- 20 | -------------------------------------------------------------------------------- /examples/arcyon/list_waiting_on.sh: -------------------------------------------------------------------------------- 1 | # List out the revisions that require another user to act next. 2 | 3 | # exit with error message if anything returns error status 4 | trap 'echo FAILED; exit 1' ERR 5 | 6 | echo Revisions you have authored, waiting on others: 7 | arcyon query "$@" --author-me --status-type open --statuses 'Needs Review' 8 | 9 | echo 10 | 11 | echo Revisions you are reviewing, waiting on others: 12 | arcyon query "$@" --reviewer-me --status-type open --statuses 'Needs Revision' 13 | # ----------------------------------------------------------------------------- 14 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 15 | # 16 | # Licensed under the Apache License, Version 2.0 (the "License"); 17 | # you may not use this file except in compliance with the License. 18 | # You may obtain a copy of the License at 19 | # 20 | # http://www.apache.org/licenses/LICENSE-2.0 21 | # 22 | # Unless required by applicable law or agreed to in writing, software 23 | # distributed under the License is distributed on an "AS IS" BASIS, 24 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | # See the License for the specific language governing permissions and 26 | # limitations under the License. 27 | # ------------------------------ END-OF-FILE ---------------------------------- 28 | -------------------------------------------------------------------------------- /examples/arcyon/nudge_stale_waiting_on.sh: -------------------------------------------------------------------------------- 1 | # comment 'nudge' on reviews which we've been waiting on for over 2 days 2 | 3 | # exit with error message if anything returns error status 4 | trap 'echo FAILED; exit 1' ERR 5 | 6 | minage="2 days" 7 | ids1=`arcyon query "$@" --author-me --status-type open --statuses 'Needs Review' --format-type ids --update-min-age "$minage"` 8 | ids2=`arcyon query "$@" --reviewer-me --status-type open --statuses 'Needs Revision' --format-type ids --update-min-age "$minage"` 9 | 10 | echo "will comment 'nudge' on the following reviews:" 11 | ids=`echo $ids1 $ids2` 12 | echo $ids 13 | 14 | read -p "Hit 'y' to continue or any other to exit: " choice 15 | if [ ! "$choice" = "y" ]; then 16 | echo user aborted. 17 | exit 2 18 | fi 19 | 20 | arcyon comment $ids "$@" -m 'nudge' 21 | # ----------------------------------------------------------------------------- 22 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 23 | # 24 | # Licensed under the Apache License, Version 2.0 (the "License"); 25 | # you may not use this file except in compliance with the License. 26 | # You may obtain a copy of the License at 27 | # 28 | # http://www.apache.org/licenses/LICENSE-2.0 29 | # 30 | # Unless required by applicable law or agreed to in writing, software 31 | # distributed under the License is distributed on an "AS IS" BASIS, 32 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 33 | # See the License for the specific language governing permissions and 34 | # limitations under the License. 35 | # ------------------------------ END-OF-FILE ---------------------------------- 36 | -------------------------------------------------------------------------------- /examples/phab-ping/ping_phabricator_actual.sh: -------------------------------------------------------------------------------- 1 | # verify that the canonical Phabricator install is reachable and running, 2 | # measure how quickly it responds 3 | ../../bin/phab-ping https://secure.phabricator.com -c 3 4 | # ----------------------------------------------------------------------------- 5 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | # ------------------------------ END-OF-FILE ---------------------------------- 19 | -------------------------------------------------------------------------------- /examples/phab-ping/watch_instance_mail_on_fail.sh: -------------------------------------------------------------------------------- 1 | set -e 2 | 3 | if [ ! "$#" = "3" ]; then 4 | echo "usage: $0 phabricator-address from-email to-email" 5 | exit 2 6 | fi 7 | 8 | address=$1 9 | from_email=$2 10 | to_email=$3 11 | 12 | # uncomment to use catchmail 13 | #sendmail="--sendmail-binary catchmail --sendmail-type catchmail" 14 | sendmail="--sendmail-binary sendmail --sendmail-type sendmail" 15 | 16 | maily="../../testbed/arcyd/maily --sender $from_email --to $to_email $sendmail" 17 | $maily --subject "started pinging $address" --message " " 18 | tempfile=`mktemp` 19 | echo "pinging $address" 20 | set +e 21 | 22 | ../../bin/phab-ping $address > $tempfile 23 | result=`(head -n 20; echo === snip ===;tail -n 20) < $tempfile` 24 | rm $tempfile 25 | if [ "$?" = "1" ]; then 26 | $maily --subject "failed pinging $address" --message "$result" 27 | echo "$result" 28 | echo FAILED 29 | exit 1 30 | else 31 | $maily --subject "stopped pinging $address" --message "$result" 32 | echo "$result" 33 | echo STOPPED 34 | fi 35 | # ----------------------------------------------------------------------------- 36 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 37 | # 38 | # Licensed under the Apache License, Version 2.0 (the "License"); 39 | # you may not use this file except in compliance with the License. 40 | # You may obtain a copy of the License at 41 | # 42 | # http://www.apache.org/licenses/LICENSE-2.0 43 | # 44 | # Unless required by applicable law or agreed to in writing, software 45 | # distributed under the License is distributed on an "AS IS" BASIS, 46 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 47 | # See the License for the specific language governing permissions and 48 | # limitations under the License. 49 | # ------------------------------ END-OF-FILE ---------------------------------- 50 | -------------------------------------------------------------------------------- /gen_test_plan.sh: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | ## generate test plan ######################################################### 3 | # # 4 | # The following operations are performed: # 5 | # :o update 'test plan' documentation at the top of each test fixture # 6 | # # 7 | # N.B. paths to scripts for which test plan needs to be generated need to be # 8 | # passed as arguments to this script # 9 | # # 10 | ############################################################################### 11 | 12 | set -e # exit immediately on error 13 | 14 | # cd to the dir of this script, so we can run scripts in the same dir 15 | cd "$(dirname "$0")" 16 | 17 | ############################################################################### 18 | # update 'test plan' documentation at the top of each test fixture 19 | ############################################################################### 20 | 21 | python meta/docgen/updatetestplan.py --force-insert "$@" 22 | printf "." 23 | 24 | 25 | # ----------------------------------------------------------------------------- 26 | # Copyright (C) 2015 Bloomberg Finance L.P. 27 | # 28 | # Licensed under the Apache License, Version 2.0 (the "License"); 29 | # you may not use this file except in compliance with the License. 30 | # You may obtain a copy of the License at 31 | # 32 | # http://www.apache.org/licenses/LICENSE-2.0 33 | # 34 | # Unless required by applicable law or agreed to in writing, software 35 | # distributed under the License is distributed on an "AS IS" BASIS, 36 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 37 | # See the License for the specific language governing permissions and 38 | # limitations under the License. 39 | # ------------------------------ END-OF-FILE ---------------------------------- 40 | -------------------------------------------------------------------------------- /meta/compileall.sh: -------------------------------------------------------------------------------- 1 | trap "echo 'FAILED!'; exit 1" ERR 2 | 3 | # cd to the dir of this script, so paths are relative 4 | cd "$(dirname "$0")" 5 | 6 | python -m compileall ../py 7 | # ----------------------------------------------------------------------------- 8 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 9 | # 10 | # Licensed under the Apache License, Version 2.0 (the "License"); 11 | # you may not use this file except in compliance with the License. 12 | # You may obtain a copy of the License at 13 | # 14 | # http://www.apache.org/licenses/LICENSE-2.0 15 | # 16 | # Unless required by applicable law or agreed to in writing, software 17 | # distributed under the License is distributed on an "AS IS" BASIS, 18 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | # See the License for the specific language governing permissions and 20 | # limitations under the License. 21 | # ------------------------------ END-OF-FILE ---------------------------------- 22 | -------------------------------------------------------------------------------- /meta/docgen/genmoddoc.py: -------------------------------------------------------------------------------- 1 | """"Automatically generate documentation from module docstrings.""" 2 | # ============================================================================= 3 | # CONTENTS 4 | # ----------------------------------------------------------------------------- 5 | # genmoddoc 6 | # 7 | # Public Functions: 8 | # main 9 | # 10 | # ----------------------------------------------------------------------------- 11 | # (this contents block is generated, edits will be lost) 12 | # ============================================================================= 13 | 14 | from __future__ import print_function 15 | 16 | import argparse 17 | import ast 18 | import os 19 | import sys 20 | 21 | 22 | def main(): 23 | argparser = argparse.ArgumentParser() 24 | argparser.add_argument( 25 | 'modules', 26 | type=str, 27 | nargs="+") 28 | argparser.add_argument( 29 | '--docfile', 30 | type=argparse.FileType('w'), 31 | required=True) 32 | args = argparser.parse_args() 33 | 34 | modules = sorted(args.modules) 35 | for m in modules: 36 | module = ast.parse(''.join(open(m))) 37 | doc = ast.get_docstring(module) 38 | 39 | if doc: 40 | print('* `' + os.path.basename(m) + '` -', file=args.docfile) 41 | print(doc.splitlines()[0], file=args.docfile) 42 | else: 43 | print('* `' + os.path.basename(m) + '`', file=args.docfile) 44 | 45 | 46 | if __name__ == "__main__": 47 | sys.exit(main()) 48 | 49 | # ----------------------------------------------------------------------------- 50 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 51 | # 52 | # Licensed under the Apache License, Version 2.0 (the "License"); 53 | # you may not use this file except in compliance with the License. 54 | # You may obtain a copy of the License at 55 | # 56 | # http://www.apache.org/licenses/LICENSE-2.0 57 | # 58 | # Unless required by applicable law or agreed to in writing, software 59 | # distributed under the License is distributed on an "AS IS" BASIS, 60 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 61 | # See the License for the specific language governing permissions and 62 | # limitations under the License. 63 | # ------------------------------ END-OF-FILE ---------------------------------- 64 | -------------------------------------------------------------------------------- /meta/install_devtools.sh: -------------------------------------------------------------------------------- 1 | set -e # exit on error 2 | sudo apt-get install pychecker 3 | sudo apt-get install python-pip 4 | sudo pip install pylint 5 | sudo pip install nose 6 | sudo pip install flake8 7 | sudo pip install snakefood 8 | sudo pip install autopep8 9 | sudo pip install docformatter 10 | # ----------------------------------------------------------------------------- 11 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 12 | # 13 | # Licensed under the Apache License, Version 2.0 (the "License"); 14 | # you may not use this file except in compliance with the License. 15 | # You may obtain a copy of the License at 16 | # 17 | # http://www.apache.org/licenses/LICENSE-2.0 18 | # 19 | # Unless required by applicable law or agreed to in writing, software 20 | # distributed under the License is distributed on an "AS IS" BASIS, 21 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | # See the License for the specific language governing permissions and 23 | # limitations under the License. 24 | # ------------------------------ END-OF-FILE ---------------------------------- 25 | -------------------------------------------------------------------------------- /meta/install_phabricator.sh: -------------------------------------------------------------------------------- 1 | set -e # exit on error 2 | sudo apt-get install puppet 3 | 4 | # cd to the dir of this script, so paths are relative 5 | cd "$(dirname "$0")" 6 | 7 | (cd ../vagrant && ./puppet-apply.sh) 8 | # ----------------------------------------------------------------------------- 9 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 10 | # 11 | # Licensed under the Apache License, Version 2.0 (the "License"); 12 | # you may not use this file except in compliance with the License. 13 | # You may obtain a copy of the License at 14 | # 15 | # http://www.apache.org/licenses/LICENSE-2.0 16 | # 17 | # Unless required by applicable law or agreed to in writing, software 18 | # distributed under the License is distributed on an "AS IS" BASIS, 19 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | # See the License for the specific language governing permissions and 21 | # limitations under the License. 22 | # ------------------------------ END-OF-FILE ---------------------------------- 23 | -------------------------------------------------------------------------------- /meta/package_deps/.gitignore: -------------------------------------------------------------------------------- 1 | package_deps.svg 2 | -------------------------------------------------------------------------------- /meta/package_deps/expected-package-deps: -------------------------------------------------------------------------------- 1 | ('phlmp', ['phlsys']) 2 | ('gabcmd', ['phlgit', 'phlsys']) 3 | ('phlgitx', ['phlgit', 'phlgitu', 'phlsys']) 4 | ('abdt', ['phlcon', 'phldef', 'phlgit', 'phlgitu', 'phlgitx', 'phlmail', 'phlsys']) 5 | ('phlurl', ['phlsys']) 6 | ('phlgit', ['phlgitu', 'phlsys']) 7 | ('lorcmd', ['phlcon', 'phlsys']) 8 | ('aoncmd', ['abdt', 'phlcon', 'phlsys']) 9 | ('atecmd', ['atet', 'phldef', 'phlsys']) 10 | ('abdcmd', ['abdi', 'abdt', 'phlgitx', 'phlsys', 'phlurl']) 11 | ('atet', ['phldef', 'phlgit', 'phlgitu', 'phlsys']) 12 | ('phlcon', ['phldef', 'phlsys']) 13 | ('phlgitu', ['phlgit', 'phlsys']) 14 | ('poxcmd', ['phlsys']) 15 | ('abdi', ['abdcmnt', 'abdmail', 'abdt', 'phlcon', 'phlgit', 'phlgitu', 'phlgitx', 'phlmail', 'phlmp', 'phlsys', 'phlurl']) 16 | ('phlsys', ['phldef']) 17 | ('abdcmnt', ['abdt', 'phlcon']) 18 | ('barcmd', ['abdt', 'phlgit', 'phlgitu', 'phlsys']) 19 | ('pigcmd', ['phlsys']) 20 | -------------------------------------------------------------------------------- /meta/package_deps/install_snakefood.sh: -------------------------------------------------------------------------------- 1 | sudo apt-get install snakefood 2 | # ----------------------------------------------------------------------------- 3 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # ------------------------------ END-OF-FILE ---------------------------------- 17 | -------------------------------------------------------------------------------- /meta/package_deps/make.sh: -------------------------------------------------------------------------------- 1 | set -e # exit immediately on error 2 | 3 | #PYTHONPATH=../../py sfood ../../py/*.py --internal | sfood-graph | dot -Tsvg -o deps.svg 4 | sfood ../../py/*.py --internal > deps 5 | ./process.py deps file-deps package-deps 6 | # ----------------------------------------------------------------------------- 7 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # ------------------------------ END-OF-FILE ---------------------------------- 21 | -------------------------------------------------------------------------------- /meta/package_deps/process.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # encoding: utf-8 3 | 4 | import argparse 5 | from collections import defaultdict 6 | import sys 7 | 8 | 9 | def main(): 10 | parser = argparse.ArgumentParser() 11 | parser.add_argument('raw_deps_in', type=str) 12 | parser.add_argument('file_deps_out', type=str) 13 | parser.add_argument('package_deps_out', type=str) 14 | args = parser.parse_args() 15 | 16 | file_deps = defaultdict(set) 17 | package_deps = defaultdict(set) 18 | 19 | with open(args.raw_deps_in, 'r') as f: 20 | for line in f: 21 | dep = eval(line) 22 | file_from = dep[0][1] 23 | file_to = dep[1][1] 24 | if file_to is not None: 25 | package_from = parsePackageName(file_from) 26 | package_to = parsePackageName(file_to) 27 | file_deps[file_from].add(file_to) 28 | if package_from != package_to: 29 | package_deps[package_from].add(package_to) 30 | 31 | dictValuesToLists(file_deps) 32 | dictValuesToLists(package_deps) 33 | writeDictToFile(args.file_deps_out, file_deps) 34 | writeDictToFile(args.package_deps_out, package_deps) 35 | 36 | 37 | def parsePackageName(s): 38 | end = s.index('_') 39 | return s[:end] 40 | 41 | 42 | def dictValuesToLists(d): 43 | for key in d: 44 | d[key] = sorted(list(d[key])) 45 | 46 | 47 | def writeDictToFile(filename, d): 48 | with open(filename, 'w') as f: 49 | for item in d.iteritems(): 50 | f.write(str(item) + '\n') 51 | 52 | 53 | if __name__ == "__main__": 54 | sys.exit(main()) 55 | 56 | # ----------------------------------------------------------------------------- 57 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 58 | # 59 | # Licensed under the Apache License, Version 2.0 (the "License"); 60 | # you may not use this file except in compliance with the License. 61 | # You may obtain a copy of the License at 62 | # 63 | # http://www.apache.org/licenses/LICENSE-2.0 64 | # 65 | # Unless required by applicable law or agreed to in writing, software 66 | # distributed under the License is distributed on an "AS IS" BASIS, 67 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 68 | # See the License for the specific language governing permissions and 69 | # limitations under the License. 70 | # ------------------------------ END-OF-FILE ---------------------------------- 71 | -------------------------------------------------------------------------------- /meta/review_states/install_graphviz.sh: -------------------------------------------------------------------------------- 1 | sudo apt-get install graphviz 2 | # ----------------------------------------------------------------------------- 3 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # ------------------------------ END-OF-FILE ---------------------------------- 17 | -------------------------------------------------------------------------------- /meta/review_states/make.sh: -------------------------------------------------------------------------------- 1 | dot -Tsvg review_states.dot -o review_states.svg 2 | # ----------------------------------------------------------------------------- 3 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # ------------------------------ END-OF-FILE ---------------------------------- 17 | -------------------------------------------------------------------------------- /meta/review_states/review_states.dot: -------------------------------------------------------------------------------- 1 | /** Phabricator Review States **/ 2 | 3 | // document the states that a Differential review can enter and the possible 4 | // transitions between those states. 5 | 6 | digraph phabricator_review_states { 7 | graph [fontname = "Helvetica"]; 8 | rankdir=LR; 9 | 10 | // colors from 'Winner Winner Chicken Dinner' by 'b_wiebe' 11 | // on kuler, https://kuler.adobe.com 12 | 13 | node [color = "#232621"]; 14 | edge [fontname = "Helvetica"]; 15 | node [style = filled, fontname = "Helvetica", fontcolor = white]; 16 | 17 | node [label = "needs review"] needs_review; 18 | node [label = "needs revision"] needs_revision; 19 | node [label = "abandoned"] abandoned; 20 | node [label = "accepted"] accepted; 21 | node [label = "closed"] closed; 22 | 23 | // author actions 24 | edge [color = "#5E7D4D"]; 25 | needs_review -> abandoned [label = "abandon"]; 26 | needs_revision -> abandoned [label = "abandon"]; 27 | accepted -> abandoned [label = "abandon"]; 28 | abandoned -> needs_review [label = "reclaim"]; 29 | needs_review -> needs_revision [label = "plan changes"]; 30 | accepted -> needs_revision [label = "plan changes"]; 31 | needs_revision -> needs_review [label = "request review"]; 32 | accepted -> needs_review [label = "request review"]; 33 | accepted -> closed [label = "close revision"]; 34 | 35 | // non-author actions 36 | edge [color = "#C74223"]; 37 | needs_review -> needs_revision [label = "request changes"]; 38 | accepted -> needs_revision [label = "request changes"]; 39 | needs_review -> accepted [label = "accept"]; 40 | needs_revision -> accepted [label = "accept"]; 41 | } 42 | 43 | /* 44 | TODO: doc these 45 | 46 | -- all states -- 47 | 48 | author: 49 | edit revision 50 | 51 | observer: 52 | subscribe 53 | commandeer 54 | 55 | reviewer: 56 | commandeer 57 | resign 58 | 59 | all: 60 | edit dependencies 61 | edit maniphest tasks 62 | download raw diff 63 | flag for later 64 | `arc patch` 65 | comment 66 | add reviewers 67 | add ccs 68 | */ 69 | -------------------------------------------------------------------------------- /proto/arcyd: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # encoding: utf-8 3 | 4 | import os 5 | import sys 6 | 7 | # The code base currently depends on version 2.7 of Python, any earlier 8 | # than that and it won't have the requisite argparse feaures. Any later 9 | # than that (3.x) and there are breaking changes in the syntax. 10 | # 11 | # Prevent nasty runtime surprises by enforcing version 2.7 as early as 12 | # possible. 13 | # 14 | # The version check itself will not work prior to Python version 2.0, 15 | # that's when sys.version_info was introduced. 16 | # 17 | if sys.version_info[:2] != (2, 7): 18 | sys.stderr.write("You need python 2.7 to run this script\n") 19 | exit(1) 20 | 21 | # append our module dirs to sys.path, which is the list of paths to search 22 | # for modules this is so we can import our libraries directly 23 | # N.B. this magic is only really passable up-front in the entrypoint module 24 | PARENT_DIR = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) 25 | sys.path.append(os.path.join(PARENT_DIR, "py", "abd")) 26 | sys.path.append(os.path.join(PARENT_DIR, "py", "phl")) 27 | 28 | # flake8 rightly complains about this, disable it with 'noqa' 29 | import abdcmd_arcyd # noqa 30 | 31 | if __name__ == "__main__": 32 | sys.exit(abdcmd_arcyd.main()) 33 | 34 | # ----------------------------------------------------------------------------- 35 | # Copyright (C) 2013-2015 Bloomberg Finance L.P. 36 | # 37 | # Licensed under the Apache License, Version 2.0 (the "License"); 38 | # you may not use this file except in compliance with the License. 39 | # You may obtain a copy of the License at 40 | # 41 | # http://www.apache.org/licenses/LICENSE-2.0 42 | # 43 | # Unless required by applicable law or agreed to in writing, software 44 | # distributed under the License is distributed on an "AS IS" BASIS, 45 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 46 | # See the License for the specific language governing permissions and 47 | # limitations under the License. 48 | # ------------------------------ END-OF-FILE ---------------------------------- 49 | -------------------------------------------------------------------------------- /proto/arcyd-tester: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # encoding: utf-8 3 | 4 | import os 5 | import sys 6 | 7 | # The code base currently depends on version 2.7 of Python, any earlier 8 | # than that and it won't have the requisite argparse feaures. Any later 9 | # than that (3.x) and there are breaking changes in the syntax. 10 | # 11 | # Prevent nasty runtime surprises by enforcing version 2.7 as early as 12 | # possible. 13 | # 14 | # The version check itself will not work prior to Python version 2.0, 15 | # that's when sys.version_info was introduced. 16 | # 17 | if sys.version_info[:2] != (2, 7): 18 | sys.stderr.write("You need python 2.7 to run this script\n") 19 | exit(1) 20 | 21 | # append our module dirs to sys.path, which is the list of paths to search 22 | # for modules this is so we can import our libraries directly 23 | # N.B. this magic is only really passable up-front in the entrypoint module 24 | PARENT_DIR = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) 25 | sys.path.append(os.path.join(PARENT_DIR, "py", "ate")) 26 | sys.path.append(os.path.join(PARENT_DIR, "py", "abd")) 27 | sys.path.append(os.path.join(PARENT_DIR, "py", "phl")) 28 | 29 | # flake8 rightly complains about this, disable it with 'noqa' 30 | import atecmd_arcydtester # noqa 31 | 32 | if __name__ == "__main__": 33 | sys.exit(atecmd_arcydtester.main()) 34 | 35 | # ----------------------------------------------------------------------------- 36 | # Copyright (C) 2013-2015 Bloomberg Finance L.P. 37 | # 38 | # Licensed under the Apache License, Version 2.0 (the "License"); 39 | # you may not use this file except in compliance with the License. 40 | # You may obtain a copy of the License at 41 | # 42 | # http://www.apache.org/licenses/LICENSE-2.0 43 | # 44 | # Unless required by applicable law or agreed to in writing, software 45 | # distributed under the License is distributed on an "AS IS" BASIS, 46 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 47 | # See the License for the specific language governing permissions and 48 | # limitations under the License. 49 | # ------------------------------ END-OF-FILE ---------------------------------- 50 | -------------------------------------------------------------------------------- /proto/barc: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # encoding: utf-8 3 | 4 | import os 5 | import sys 6 | 7 | # The code base currently depends on version 2.7 of Python, any earlier 8 | # than that and it won't have the requisite argparse feaures. Any later 9 | # than that (3.x) and there are breaking changes in the syntax. 10 | # 11 | # Prevent nasty runtime surprises by enforcing version 2.7 as early as 12 | # possible. 13 | # 14 | # The version check itself will not work prior to Python version 2.0, 15 | # that's when sys.version_info was introduced. 16 | # 17 | if sys.version_info[:2] != (2, 7): 18 | sys.stderr.write("You need python 2.7 to run this script\n") 19 | exit(1) 20 | 21 | # append our module dirs to sys.path, which is the list of paths to search 22 | # for modules this is so we can import our libraries directly 23 | # N.B. this magic is only really passable up-front in the entrypoint module 24 | PARENT_DIR = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) 25 | sys.path.append(os.path.join(PARENT_DIR, "py", "abd")) 26 | sys.path.append(os.path.join(PARENT_DIR, "py", "bar")) 27 | sys.path.append(os.path.join(PARENT_DIR, "py", "phl")) 28 | 29 | # flake8 rightly complains about this, disable it with 'noqa' 30 | import barcmd_barc # noqa 31 | 32 | if __name__ == "__main__": 33 | sys.exit(barcmd_barc.main()) 34 | 35 | # ----------------------------------------------------------------------------- 36 | # Copyright (C) 2013-2015 Bloomberg Finance L.P. 37 | # 38 | # Licensed under the Apache License, Version 2.0 (the "License"); 39 | # you may not use this file except in compliance with the License. 40 | # You may obtain a copy of the License at 41 | # 42 | # http://www.apache.org/licenses/LICENSE-2.0 43 | # 44 | # Unless required by applicable law or agreed to in writing, software 45 | # distributed under the License is distributed on an "AS IS" BASIS, 46 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 47 | # See the License for the specific language governing permissions and 48 | # limitations under the License. 49 | # ------------------------------ END-OF-FILE ---------------------------------- 50 | -------------------------------------------------------------------------------- /proto/conduit-proxy: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # encoding: utf-8 3 | 4 | import os 5 | import sys 6 | 7 | # The code base currently depends on version 2.7 of Python, any earlier 8 | # than that and it won't have the requisite argparse feaures. Any later 9 | # than that (3.x) and there are breaking changes in the syntax. 10 | # 11 | # Prevent nasty runtime surprises by enforcing version 2.7 as early as 12 | # possible. 13 | # 14 | # The version check itself will not work prior to Python version 2.0, 15 | # that's when sys.version_info was introduced. 16 | # 17 | if sys.version_info[:2] != (2, 7): 18 | sys.stderr.write("You need python 2.7 to run this script\n") 19 | exit(1) 20 | 21 | # append our module dirs to sys.path, which is the list of paths to search 22 | # for modules this is so we can import our libraries directly 23 | # N.B. this magic is only really passable up-front in the entrypoint module 24 | PARENT_DIR = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) 25 | sys.path.append(os.path.join(PARENT_DIR, "py", "pox")) 26 | sys.path.append(os.path.join(PARENT_DIR, "py", "phl")) 27 | 28 | # flake8 rightly complains about this, disable it with 'noqa' 29 | import poxcmd_conduitproxy # noqa 30 | 31 | if __name__ == "__main__": 32 | sys.exit(poxcmd_conduitproxy.main()) 33 | 34 | 35 | # ----------------------------------------------------------------------------- 36 | # Copyright (C) 2013-2015 Bloomberg Finance L.P. 37 | # 38 | # Licensed under the Apache License, Version 2.0 (the "License"); 39 | # you may not use this file except in compliance with the License. 40 | # You may obtain a copy of the License at 41 | # 42 | # http://www.apache.org/licenses/LICENSE-2.0 43 | # 44 | # Unless required by applicable law or agreed to in writing, software 45 | # distributed under the License is distributed on an "AS IS" BASIS, 46 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 47 | # See the License for the specific language governing permissions and 48 | # limitations under the License. 49 | # ------------------------------ END-OF-FILE ---------------------------------- 50 | -------------------------------------------------------------------------------- /proto/git-phab-log: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # encoding: utf-8 3 | 4 | import os 5 | import sys 6 | 7 | # The code base currently depends on version 2.7 of Python, any earlier 8 | # than that and it won't have the requisite argparse feaures. Any later 9 | # than that (3.x) and there are breaking changes in the syntax. 10 | # 11 | # Prevent nasty runtime surprises by enforcing version 2.7 as early as 12 | # possible. 13 | # 14 | # The version check itself will not work prior to Python version 2.0, 15 | # that's when sys.version_info was introduced. 16 | # 17 | if sys.version_info[:2] != (2, 7): 18 | sys.stderr.write("You need python 2.7 to run this script\n") 19 | exit(1) 20 | 21 | # append our module dirs to sys.path, which is the list of paths to search 22 | # for modules this is so we can import our libraries directly 23 | # N.B. this magic is only really passable up-front in the entrypoint module 24 | PARENT_DIR = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) 25 | sys.path.append(os.path.join(PARENT_DIR, "py", "gab")) 26 | sys.path.append(os.path.join(PARENT_DIR, "py", "phl")) 27 | 28 | # flake8 rightly complains about this, disable it with 'noqa' 29 | import gabcmd_gitphablog # noqa 30 | 31 | if __name__ == "__main__": 32 | sys.exit(gabcmd_gitphablog.main()) 33 | 34 | # ----------------------------------------------------------------------------- 35 | # Copyright (C) 2013-2015 Bloomberg Finance L.P. 36 | # 37 | # Licensed under the Apache License, Version 2.0 (the "License"); 38 | # you may not use this file except in compliance with the License. 39 | # You may obtain a copy of the License at 40 | # 41 | # http://www.apache.org/licenses/LICENSE-2.0 42 | # 43 | # Unless required by applicable law or agreed to in writing, software 44 | # distributed under the License is distributed on an "AS IS" BASIS, 45 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 46 | # See the License for the specific language governing permissions and 47 | # limitations under the License. 48 | # ------------------------------ END-OF-FILE ---------------------------------- 49 | -------------------------------------------------------------------------------- /proto/linterate: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # encoding: utf-8 3 | 4 | import os 5 | import sys 6 | 7 | # The code base currently depends on version 2.7 of Python, any earlier 8 | # than that and it won't have the requisite argparse feaures. Any later 9 | # than that (3.x) and there are breaking changes in the syntax. 10 | # 11 | # Prevent nasty runtime surprises by enforcing version 2.7 as early as 12 | # possible. 13 | # 14 | # The version check itself will not work prior to Python version 2.0, 15 | # that's when sys.version_info was introduced. 16 | # 17 | if sys.version_info[:2] != (2, 7): 18 | sys.stderr.write("You need python 2.7 to run this script\n") 19 | exit(1) 20 | 21 | # append our module dirs to sys.path, which is the list of paths to search 22 | # for modules this is so we can import our libraries directly 23 | # N.B. this magic is only really passable up-front in the entrypoint module 24 | PARENT_DIR = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) 25 | sys.path.append(os.path.join(PARENT_DIR, "py", "lor")) 26 | sys.path.append(os.path.join(PARENT_DIR, "py", "phl")) 27 | 28 | # flake8 rightly complains about this, disable it with 'noqa' 29 | import lorcmd_linterate # noqa 30 | 31 | if __name__ == "__main__": 32 | sys.exit(lorcmd_linterate.main()) 33 | 34 | # ----------------------------------------------------------------------------- 35 | # Copyright (C) 2013-2015 Bloomberg Finance L.P. 36 | # 37 | # Licensed under the Apache License, Version 2.0 (the "License"); 38 | # you may not use this file except in compliance with the License. 39 | # You may obtain a copy of the License at 40 | # 41 | # http://www.apache.org/licenses/LICENSE-2.0 42 | # 43 | # Unless required by applicable law or agreed to in writing, software 44 | # distributed under the License is distributed on an "AS IS" BASIS, 45 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 46 | # See the License for the specific language governing permissions and 47 | # limitations under the License. 48 | # ------------------------------ END-OF-FILE ---------------------------------- 49 | -------------------------------------------------------------------------------- /py/README.md: -------------------------------------------------------------------------------- 1 | Python Source 2 | ------------- 3 | 4 | The python modules are divided into 'package groups' which are in turn 5 | divided into 'packages'. 6 | 7 | The package group and package is pre-pended to the name of each module, this 8 | naming convention enforces explicit imports when re-using code and disallows 9 | wide import statements like 'import abd'. 10 | 11 | This naming convention also promotes the use of fully-qualified names in 12 | code so that it's easy to predict which module a sybmol comes from. 13 | 14 | To simplify imports, all the Python source for each package group is in the 15 | same directory; this may be revisited as the source base grows. Since the 16 | name of each module is unique, there is no danger of name collision. 17 | 18 | These are the top-level package groups: 19 | * `abd` - Arcyd Branch Daemon implementation (may rename this to `arc` later) 20 | * `aon` - Arcyon implementation 21 | * `phl` - code which can be considered re-usable as a 'PHabricator Library'. 22 | * `pig` - Phab-ping implementation 23 | 24 | ----- 25 | 26 | The **abd** package group is divided into packages like so: 27 | 28 | * `abdcmd` - implementation of Arcyd subcommands 29 | * `abdcmnt` - format and submit event-related comments to Differential reviews 30 | * `abdi` - high-level Arcyd implementation details 31 | * `abdmail` - format and send event-related emails to people 32 | * `abdt` - shared types, conventions and tools 33 | 34 | ----- 35 | 36 | The **aon** package group is divided into packages like so: 37 | 38 | * `aoncmd` - implementation of Arcyon subcommands 39 | * `aont` - shared types, conventions and tools 40 | 41 | ----- 42 | 43 | The **phl** package group is divided into packages like so: 44 | 45 | * `phlcon` - thin wrappers around Phabricator Conduit APIs 46 | * `phldef` - predefined data and constants 47 | * `phlgit` - thin wrappers around Git subcommands 48 | * `phlgitu` - high-level Git utilities 49 | * `phlsys` - wrappers around interaction with the operating system 50 | -------------------------------------------------------------------------------- /py/abd/abdcmd_reload.py: -------------------------------------------------------------------------------- 1 | """Reload the arcyd instance for the current directory.""" 2 | # ============================================================================= 3 | # CONTENTS 4 | # ----------------------------------------------------------------------------- 5 | # abdcmd_reload 6 | # 7 | # Public Functions: 8 | # getFromfilePrefixChars 9 | # setupParser 10 | # process 11 | # 12 | # ----------------------------------------------------------------------------- 13 | # (this contents block is generated, edits will be lost) 14 | # ============================================================================= 15 | 16 | from __future__ import absolute_import 17 | from __future__ import division 18 | from __future__ import print_function 19 | 20 | import logging 21 | 22 | import abdi_startstop 23 | 24 | 25 | def getFromfilePrefixChars(): 26 | return None 27 | 28 | 29 | def setupParser(parser): 30 | pass 31 | 32 | 33 | def process(unused_args): 34 | logging.getLogger().setLevel(logging.DEBUG) 35 | abdi_startstop.reload_arcyd() 36 | 37 | # ----------------------------------------------------------------------------- 38 | # Copyright (C) 2014-2015 Bloomberg Finance L.P. 39 | # 40 | # Licensed under the Apache License, Version 2.0 (the "License"); 41 | # you may not use this file except in compliance with the License. 42 | # You may obtain a copy of the License at 43 | # 44 | # http://www.apache.org/licenses/LICENSE-2.0 45 | # 46 | # Unless required by applicable law or agreed to in writing, software 47 | # distributed under the License is distributed on an "AS IS" BASIS, 48 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 49 | # See the License for the specific language governing permissions and 50 | # limitations under the License. 51 | # ------------------------------ END-OF-FILE ---------------------------------- 52 | -------------------------------------------------------------------------------- /py/abd/abdcmd_restart.py: -------------------------------------------------------------------------------- 1 | """Restart the arcyd instance for the current directory.""" 2 | # ============================================================================= 3 | # CONTENTS 4 | # ----------------------------------------------------------------------------- 5 | # abdcmd_restart 6 | # 7 | # Public Functions: 8 | # getFromfilePrefixChars 9 | # setupParser 10 | # process 11 | # 12 | # ----------------------------------------------------------------------------- 13 | # (this contents block is generated, edits will be lost) 14 | # ============================================================================= 15 | 16 | from __future__ import absolute_import 17 | from __future__ import division 18 | from __future__ import print_function 19 | 20 | import logging 21 | 22 | import abdi_startstop 23 | 24 | 25 | def getFromfilePrefixChars(): 26 | return None 27 | 28 | 29 | def setupParser(parser): 30 | parser.add_argument( 31 | '--foreground', 32 | '-f', 33 | action='store_true', 34 | help="supply this argument to run arcyd interactively in the " 35 | "foreground") 36 | parser.add_argument( 37 | '--no-loop', 38 | action='store_true', 39 | help="supply this argument to only process each repo once then exit") 40 | parser.add_argument( 41 | '-m', 42 | '--message', 43 | default='', 44 | help="reason for restarting arcyd") 45 | 46 | 47 | def process(args): 48 | logging.getLogger().setLevel(logging.DEBUG) 49 | abdi_startstop.start_arcyd(daemonize=not args.foreground, 50 | loop=not args.no_loop, 51 | restart=True, 52 | stop_message=args.message) 53 | 54 | # ----------------------------------------------------------------------------- 55 | # Copyright (C) 2015 Bloomberg Finance L.P. 56 | # 57 | # Licensed under the Apache License, Version 2.0 (the "License"); 58 | # you may not use this file except in compliance with the License. 59 | # You may obtain a copy of the License at 60 | # 61 | # http://www.apache.org/licenses/LICENSE-2.0 62 | # 63 | # Unless required by applicable law or agreed to in writing, software 64 | # distributed under the License is distributed on an "AS IS" BASIS, 65 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 66 | # See the License for the specific language governing permissions and 67 | # limitations under the License. 68 | # ------------------------------ END-OF-FILE ---------------------------------- 69 | -------------------------------------------------------------------------------- /py/abd/abdcmd_start.py: -------------------------------------------------------------------------------- 1 | """Start the arcyd instance for the current directory, if not already going.""" 2 | # ============================================================================= 3 | # CONTENTS 4 | # ----------------------------------------------------------------------------- 5 | # abdcmd_start 6 | # 7 | # Public Functions: 8 | # getFromfilePrefixChars 9 | # setupParser 10 | # process 11 | # 12 | # ----------------------------------------------------------------------------- 13 | # (this contents block is generated, edits will be lost) 14 | # ============================================================================= 15 | 16 | from __future__ import absolute_import 17 | from __future__ import division 18 | from __future__ import print_function 19 | 20 | import logging 21 | 22 | import abdi_startstop 23 | 24 | 25 | def getFromfilePrefixChars(): 26 | return None 27 | 28 | 29 | def setupParser(parser): 30 | parser.add_argument( 31 | '--foreground', 32 | '-f', 33 | action='store_true', 34 | help="supply this argument to run arcyd interactively in the " 35 | "foreground") 36 | parser.add_argument( 37 | '--no-loop', 38 | action='store_true', 39 | help="supply this argument to only process each repo once then exit") 40 | 41 | 42 | def process(args): 43 | logging.getLogger().setLevel(logging.DEBUG) 44 | abdi_startstop.start_arcyd(daemonize=not args.foreground, 45 | loop=not args.no_loop) 46 | 47 | # ----------------------------------------------------------------------------- 48 | # Copyright (C) 2014-2015 Bloomberg Finance L.P. 49 | # 50 | # Licensed under the Apache License, Version 2.0 (the "License"); 51 | # you may not use this file except in compliance with the License. 52 | # You may obtain a copy of the License at 53 | # 54 | # http://www.apache.org/licenses/LICENSE-2.0 55 | # 56 | # Unless required by applicable law or agreed to in writing, software 57 | # distributed under the License is distributed on an "AS IS" BASIS, 58 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 59 | # See the License for the specific language governing permissions and 60 | # limitations under the License. 61 | # ------------------------------ END-OF-FILE ---------------------------------- 62 | -------------------------------------------------------------------------------- /py/abd/abdcmd_stop.py: -------------------------------------------------------------------------------- 1 | """Stop the arcyd instance for the current directory.""" 2 | # ============================================================================= 3 | # CONTENTS 4 | # ----------------------------------------------------------------------------- 5 | # abdcmd_stop 6 | # 7 | # Public Functions: 8 | # getFromfilePrefixChars 9 | # setupParser 10 | # process 11 | # 12 | # ----------------------------------------------------------------------------- 13 | # (this contents block is generated, edits will be lost) 14 | # ============================================================================= 15 | 16 | from __future__ import absolute_import 17 | from __future__ import division 18 | from __future__ import print_function 19 | 20 | import abdi_startstop 21 | 22 | 23 | def getFromfilePrefixChars(): 24 | return None 25 | 26 | 27 | def setupParser(parser): 28 | parser.add_argument( 29 | '-m', 30 | '--message', 31 | default='', 32 | help="reason for stopping arcyd") 33 | 34 | 35 | def process(args): 36 | abdi_startstop.stop_arcyd(args.message) 37 | 38 | 39 | # ----------------------------------------------------------------------------- 40 | # Copyright (C) 2014-2015 Bloomberg Finance L.P. 41 | # 42 | # Licensed under the Apache License, Version 2.0 (the "License"); 43 | # you may not use this file except in compliance with the License. 44 | # You may obtain a copy of the License at 45 | # 46 | # http://www.apache.org/licenses/LICENSE-2.0 47 | # 48 | # Unless required by applicable law or agreed to in writing, software 49 | # distributed under the License is distributed on an "AS IS" BASIS, 50 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 51 | # See the License for the specific language governing permissions and 52 | # limitations under the License. 53 | # ------------------------------ END-OF-FILE ---------------------------------- 54 | -------------------------------------------------------------------------------- /py/abd/abdi_processexitcodes.py: -------------------------------------------------------------------------------- 1 | """Setup to process multiple repos.""" 2 | from __future__ import absolute_import 3 | from __future__ import division 4 | from __future__ import print_function 5 | # ============================================================================= 6 | # CONTENTS 7 | # ----------------------------------------------------------------------------- 8 | # abdi_processexitcodes 9 | # 10 | # Public Classes: 11 | # ExitCodes 12 | # 13 | # ----------------------------------------------------------------------------- 14 | # (this contents block is generated, edits will be lost) 15 | # ============================================================================= 16 | 17 | 18 | class ExitCodes(object): 19 | ec_exit = 'ec_exit' 20 | ec_reload = 'ec_reload' 21 | 22 | 23 | # ----------------------------------------------------------------------------- 24 | # Copyright (C) 2015 Bloomberg Finance L.P. 25 | # 26 | # Licensed under the Apache License, Version 2.0 (the "License"); 27 | # you may not use this file except in compliance with the License. 28 | # You may obtain a copy of the License at 29 | # 30 | # http://www.apache.org/licenses/LICENSE-2.0 31 | # 32 | # Unless required by applicable law or agreed to in writing, software 33 | # distributed under the License is distributed on an "AS IS" BASIS, 34 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 35 | # See the License for the specific language governing permissions and 36 | # limitations under the License. 37 | # ------------------------------ END-OF-FILE ---------------------------------- 38 | -------------------------------------------------------------------------------- /py/abd/abdt_conduitmock__t.py: -------------------------------------------------------------------------------- 1 | """Test suite for abdt_conduitmock.""" 2 | # ============================================================================= 3 | # TEST PLAN 4 | # ----------------------------------------------------------------------------- 5 | # Here we detail the things we are concerned to test and specify which tests 6 | # cover those concerns. 7 | # 8 | # Concerns: 9 | # [ B] public interface of mock matches abdt_conduit.Conduit 10 | # ----------------------------------------------------------------------------- 11 | # Tests: 12 | # [ A] test_A_Breathing 13 | # [ B] test_B_InterfaceMatchesRealConduit 14 | # ============================================================================= 15 | 16 | from __future__ import absolute_import 17 | from __future__ import division 18 | from __future__ import print_function 19 | 20 | import unittest 21 | 22 | import phlsys_compiface 23 | 24 | import abdt_conduit 25 | import abdt_conduitmock 26 | 27 | 28 | class Test(unittest.TestCase): 29 | 30 | def setUp(self): 31 | pass 32 | 33 | def tearDown(self): 34 | pass 35 | 36 | def test_A_Breathing(self): 37 | pass 38 | 39 | def test_B_InterfaceMatchesRealConduit(self): 40 | self.assertTrue( 41 | phlsys_compiface.check_public_ifaces_match( 42 | abdt_conduit.Conduit, 43 | abdt_conduitmock.ConduitMock)) 44 | 45 | 46 | # ----------------------------------------------------------------------------- 47 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 48 | # 49 | # Licensed under the Apache License, Version 2.0 (the "License"); 50 | # you may not use this file except in compliance with the License. 51 | # You may obtain a copy of the License at 52 | # 53 | # http://www.apache.org/licenses/LICENSE-2.0 54 | # 55 | # Unless required by applicable law or agreed to in writing, software 56 | # distributed under the License is distributed on an "AS IS" BASIS, 57 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 58 | # See the License for the specific language governing permissions and 59 | # limitations under the License. 60 | # ------------------------------ END-OF-FILE ---------------------------------- 61 | -------------------------------------------------------------------------------- /py/abd/abdt_naming__t.py: -------------------------------------------------------------------------------- 1 | """Test suite for abdt_naming.""" 2 | # ============================================================================= 3 | # TEST PLAN 4 | # ----------------------------------------------------------------------------- 5 | # Here we detail the things we are concerned to test and specify which tests 6 | # cover those concerns. 7 | # 8 | # Concerns: 9 | # [ ] 10 | # ----------------------------------------------------------------------------- 11 | # Tests: 12 | # [ A] test_A_Breathing 13 | # ============================================================================= 14 | 15 | from __future__ import absolute_import 16 | from __future__ import division 17 | from __future__ import print_function 18 | 19 | import unittest 20 | 21 | # import abdt_naming 22 | 23 | 24 | class Test(unittest.TestCase): 25 | 26 | def setUp(self): 27 | pass 28 | 29 | def tearDown(self): 30 | pass 31 | 32 | def test_A_Breathing(self): 33 | # Usage example: 34 | # >>> naming = ClassicNaming() 35 | # >>> func = naming.make_tracker_branch_from_name 36 | # >>> _get_branches(['dev/arcyd/ok/mywork/master/99'], func) 37 | # ... # doctest: +NORMALIZE_WHITESPACE 38 | # [abdt_naming.TrackerBranch("dev/arcyd/ok/mywork/master/99")] 39 | # 40 | # >>> _get_branches([], func) 41 | # [] 42 | # 43 | # >>> _get_branches(['invalid'], func) 44 | # [] 45 | # 46 | pass 47 | 48 | 49 | # ----------------------------------------------------------------------------- 50 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 51 | # 52 | # Licensed under the Apache License, Version 2.0 (the "License"); 53 | # you may not use this file except in compliance with the License. 54 | # You may obtain a copy of the License at 55 | # 56 | # http://www.apache.org/licenses/LICENSE-2.0 57 | # 58 | # Unless required by applicable law or agreed to in writing, software 59 | # distributed under the License is distributed on an "AS IS" BASIS, 60 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 61 | # See the License for the specific language governing permissions and 62 | # limitations under the License. 63 | # ------------------------------ END-OF-FILE ---------------------------------- 64 | -------------------------------------------------------------------------------- /py/aon/README.md: -------------------------------------------------------------------------------- 1 | # aon 2 | * `aoncmd_arcyon.py` - 3 | Arcyon - util to interact with Conduit API from the command-line. 4 | * `aoncmd_comment.py` - 5 | create a comment on differential reviews. 6 | * `aoncmd_commentinline.py` - 7 | create an inline comment on a differential review. 8 | * `aoncmd_createrevision.py` - 9 | Create a new revision in differential. 10 | * `aoncmd_getdiff.py` - 11 | Get a diff from differential, along with metadata. 12 | * `aoncmd_gitdiffhelper.py` - 13 | create a diff from a git repository, reducing the diff if it is too big. 14 | * `aoncmd_paste.py` - 15 | Create a new paste. 16 | * `aoncmd_query.py` - 17 | display and filter the list of differential revisions. 18 | * `aoncmd_rawdiff.py` - 19 | Create a raw diff in differential. 20 | * `aoncmd_showconfig.py` - 21 | show the configuration as discovered from the current directory. 22 | * `aoncmd_taskcreate.py` - 23 | Create a new task in maniphest. 24 | * `aoncmd_taskquery.py` - 25 | display and filter the list of maniphest tasks. 26 | * `aoncmd_taskupdate.py` - 27 | Update a task in maniphest. 28 | * `aoncmd_updaterevision.py` - 29 | Update an existing revision in differential. 30 | 31 | ----- 32 | *please note: this file is generated, edits will be lost* 33 | -------------------------------------------------------------------------------- /py/aon/aoncmd_showconfig.py: -------------------------------------------------------------------------------- 1 | """show the configuration as discovered from the current directory.""" 2 | # ============================================================================= 3 | # CONTENTS 4 | # ----------------------------------------------------------------------------- 5 | # aoncmd_showconfig 6 | # 7 | # Public Functions: 8 | # getFromfilePrefixChars 9 | # setupParser 10 | # process 11 | # 12 | # ----------------------------------------------------------------------------- 13 | # (this contents block is generated, edits will be lost) 14 | # ============================================================================= 15 | 16 | from __future__ import absolute_import 17 | from __future__ import division 18 | from __future__ import print_function 19 | 20 | import phlsys_makeconduit 21 | 22 | 23 | def getFromfilePrefixChars(): 24 | return "" 25 | 26 | 27 | def setupParser(parser): 28 | phlsys_makeconduit.add_argparse_arguments(parser) 29 | 30 | 31 | def process(args): 32 | getExplanation = phlsys_makeconduit.get_uri_user_cert_explanation 33 | uri, user, cert, explanation = getExplanation( 34 | args.uri, args.user, args.cert) 35 | print(explanation) 36 | print() 37 | print("uri : ", uri) 38 | print("user: ", user) 39 | print("cert: ", phlsys_makeconduit.obscured_cert(cert)) 40 | 41 | 42 | # ----------------------------------------------------------------------------- 43 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 44 | # 45 | # Licensed under the Apache License, Version 2.0 (the "License"); 46 | # you may not use this file except in compliance with the License. 47 | # You may obtain a copy of the License at 48 | # 49 | # http://www.apache.org/licenses/LICENSE-2.0 50 | # 51 | # Unless required by applicable law or agreed to in writing, software 52 | # distributed under the License is distributed on an "AS IS" BASIS, 53 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 54 | # See the License for the specific language governing permissions and 55 | # limitations under the License. 56 | # ------------------------------ END-OF-FILE ---------------------------------- 57 | -------------------------------------------------------------------------------- /py/ate/README.md: -------------------------------------------------------------------------------- 1 | # ate 2 | * `atecmd_arcydtester.py` - 3 | Arcyd tester - command-line utility to exercise arcyd. 4 | * `atet_arcyd_instance.py` - 5 | Tools to start and manage an Arcyd instance. 6 | * `atet_fixture.py` - 7 | Creates a fixture with Arcyd setup to perform tests. 8 | * `atet_sharedrepo.py` - 9 | Simulates a central repository where multiple workers can collaborate. 10 | * `atet_worker.py` - 11 | Utilities to simulate a person working with Phabricator, Git and Arcyd. 12 | 13 | ----- 14 | *please note: this file is generated, edits will be lost* 15 | -------------------------------------------------------------------------------- /py/bar/README.md: -------------------------------------------------------------------------------- 1 | # bar 2 | * `barcmd_barc.py` - 3 | Barc - a command-line client to complement 'arcyd'. 4 | * `barcmd_gc.py` - 5 | DEPRECATED: Garbage collect in your local git repository. 6 | * `barcmd_list.py` - 7 | List the reviews and corresponding branches in the current repository. 8 | 9 | ----- 10 | *please note: this file is generated, edits will be lost* 11 | -------------------------------------------------------------------------------- /py/gab/README.md: -------------------------------------------------------------------------------- 1 | # gab 2 | * `gabcmd_gitphablog.py` - 3 | git-phab-log - a Phabricator git-log parser. 4 | 5 | ----- 6 | *please note: this file is generated, edits will be lost* 7 | -------------------------------------------------------------------------------- /py/lor/README.md: -------------------------------------------------------------------------------- 1 | # lor 2 | * `lorcmd_linterate.py` - 3 | linterate - an automated lint excitor. 4 | 5 | ----- 6 | *please note: this file is generated, edits will be lost* 7 | -------------------------------------------------------------------------------- /py/phl/phlcon_paste.py: -------------------------------------------------------------------------------- 1 | """Wrapper to call Phabricator's Paste Conduit API.""" 2 | # ============================================================================= 3 | # CONTENTS 4 | # ----------------------------------------------------------------------------- 5 | # phlcon_paste 6 | # 7 | # Public Functions: 8 | # create_paste 9 | # 10 | # Public Assignments: 11 | # CreatePasteResponse 12 | # 13 | # ----------------------------------------------------------------------------- 14 | # (this contents block is generated, edits will be lost) 15 | # ============================================================================= 16 | 17 | from __future__ import absolute_import 18 | from __future__ import division 19 | from __future__ import print_function 20 | 21 | import phlsys_namedtuple 22 | 23 | 24 | CreatePasteResponse = phlsys_namedtuple.make_named_tuple( 25 | 'CreatePasteResponse', 26 | required=[ 27 | 'id', 'phid', 'authorPHID', 'filePHID', 'title', 'parentPHID', 28 | 'dateCreated', 'language', 'objectName', 'uri', 'content' 29 | ], 30 | defaults={}, 31 | ignored=[]) 32 | 33 | 34 | def create_paste(conduit, content, title="", language=""): 35 | """Creates a paste in Phabricator. 36 | 37 | :conduit: conduit to operate on 38 | :content: the content of the paste 39 | :title: the title of the paste 40 | :language: the programming language of the paste ie. c++ 41 | :returns: pasteResponse named tuple 42 | 43 | """ 44 | response = conduit( 45 | "paste.create", 46 | {"content": content, "title": title, "language": language}) 47 | return CreatePasteResponse(**response) 48 | 49 | # ----------------------------------------------------------------------------- 50 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 51 | # 52 | # Licensed under the Apache License, Version 2.0 (the "License"); 53 | # you may not use this file except in compliance with the License. 54 | # You may obtain a copy of the License at 55 | # 56 | # http://www.apache.org/licenses/LICENSE-2.0 57 | # 58 | # Unless required by applicable law or agreed to in writing, software 59 | # distributed under the License is distributed on an "AS IS" BASIS, 60 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 61 | # See the License for the specific language governing permissions and 62 | # limitations under the License. 63 | # ------------------------------ END-OF-FILE ---------------------------------- 64 | -------------------------------------------------------------------------------- /py/phl/phlgit_commit.py: -------------------------------------------------------------------------------- 1 | """Dependable wrapper for invocations of git commit.""" 2 | # ============================================================================= 3 | # CONTENTS 4 | # ----------------------------------------------------------------------------- 5 | # phlgit_commit 6 | # 7 | # Public Functions: 8 | # index 9 | # allow_empty 10 | # 11 | # ----------------------------------------------------------------------------- 12 | # (this contents block is generated, edits will be lost) 13 | # ============================================================================= 14 | 15 | from __future__ import absolute_import 16 | from __future__ import division 17 | from __future__ import print_function 18 | 19 | 20 | def index(repo, message): 21 | """Create a new commit from the contents of the index. 22 | 23 | :repo: a callable supporting git commands, e.g. repo("status") 24 | :message: the string message for the commit 25 | :returns: None 26 | 27 | """ 28 | repo('commit', '-m', message) 29 | 30 | 31 | def allow_empty(repo, message): 32 | """Create a new commit from the contents of the index, which may be empty. 33 | 34 | :repo: a callable supporting git commands, e.g. repo("status") 35 | :message: the string message for the commit 36 | :returns: None 37 | 38 | """ 39 | repo('commit', '--allow-empty', '-m', message) 40 | 41 | 42 | # ----------------------------------------------------------------------------- 43 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 44 | # 45 | # Licensed under the Apache License, Version 2.0 (the "License"); 46 | # you may not use this file except in compliance with the License. 47 | # You may obtain a copy of the License at 48 | # 49 | # http://www.apache.org/licenses/LICENSE-2.0 50 | # 51 | # Unless required by applicable law or agreed to in writing, software 52 | # distributed under the License is distributed on an "AS IS" BASIS, 53 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 54 | # See the License for the specific language governing permissions and 55 | # limitations under the License. 56 | # ------------------------------ END-OF-FILE ---------------------------------- 57 | -------------------------------------------------------------------------------- /py/phl/phlgit_diffindex.py: -------------------------------------------------------------------------------- 1 | """Wrapper around 'git diff-index'. 2 | 3 | Compares the content and mode of the blobs found via a tree object with 4 | the content of the current index and, optionally ignoring the stat state 5 | of the file on disk. When paths are specified, compares only those named 6 | paths. Otherwise all entries in the index are compared. 7 | 8 | """ 9 | # ============================================================================= 10 | # CONTENTS 11 | # ----------------------------------------------------------------------------- 12 | # phlgit_diffindex 13 | # 14 | # Public Functions: 15 | # is_index_dirty 16 | # 17 | # ----------------------------------------------------------------------------- 18 | # (this contents block is generated, edits will be lost) 19 | # ============================================================================= 20 | 21 | from __future__ import absolute_import 22 | from __future__ import division 23 | from __future__ import print_function 24 | 25 | 26 | def is_index_dirty(repo): 27 | """Return True if there are staged changes, False otherwise. 28 | 29 | :repo: a callable supporting git commands, e.g. repo("status") 30 | :returns: Bool 31 | 32 | """ 33 | result = True 34 | if not repo("diff-index", "--cached", "HEAD", "--name-only"): 35 | result = False 36 | return result 37 | 38 | 39 | # ----------------------------------------------------------------------------- 40 | # Copyright (C) 2014-2016 Bloomberg Finance L.P. 41 | # 42 | # Licensed under the Apache License, Version 2.0 (the "License"); 43 | # you may not use this file except in compliance with the License. 44 | # You may obtain a copy of the License at 45 | # 46 | # http://www.apache.org/licenses/LICENSE-2.0 47 | # 48 | # Unless required by applicable law or agreed to in writing, software 49 | # distributed under the License is distributed on an "AS IS" BASIS, 50 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 51 | # See the License for the specific language governing permissions and 52 | # limitations under the License. 53 | # ------------------------------ END-OF-FILE ---------------------------------- 54 | -------------------------------------------------------------------------------- /py/phl/phlgit_hashobject.py: -------------------------------------------------------------------------------- 1 | """Wrapper around 'git hash-object'.""" 2 | # ============================================================================= 3 | # CONTENTS 4 | # ----------------------------------------------------------------------------- 5 | # phlgit_hashobject 6 | # 7 | # Public Functions: 8 | # write_string 9 | # 10 | # ----------------------------------------------------------------------------- 11 | # (this contents block is generated, edits will be lost) 12 | # ============================================================================= 13 | 14 | from __future__ import absolute_import 15 | from __future__ import division 16 | from __future__ import print_function 17 | 18 | 19 | def write_string(repo, s): 20 | """Return the hash of the supplied string 's' and write the object. 21 | 22 | Note that if an object with the same hash (should be the same content) is 23 | already in the object store then nothing will be written. The hash will 24 | still be returned. 25 | 26 | Note that the hash returned is that of ( + s) so you will not 27 | get the same result if you simply did: 28 | hashlib.sha1(s) 29 | 30 | :repo: a callable supporting git commands, e.g. repo("status") 31 | :s: the string to calculate the SHA1 of and to write to the object store 32 | :returns: the SHA1 of the object 33 | 34 | """ 35 | return repo('hash-object', '-w', '--stdin', stdin=s).strip() 36 | 37 | 38 | # ----------------------------------------------------------------------------- 39 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 40 | # 41 | # Licensed under the Apache License, Version 2.0 (the "License"); 42 | # you may not use this file except in compliance with the License. 43 | # You may obtain a copy of the License at 44 | # 45 | # http://www.apache.org/licenses/LICENSE-2.0 46 | # 47 | # Unless required by applicable law or agreed to in writing, software 48 | # distributed under the License is distributed on an "AS IS" BASIS, 49 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 50 | # See the License for the specific language governing permissions and 51 | # limitations under the License. 52 | # ------------------------------ END-OF-FILE ---------------------------------- 53 | -------------------------------------------------------------------------------- /py/phl/phlgit_rebase.py: -------------------------------------------------------------------------------- 1 | """Dependable wrapper for invocations of git rebase.""" 2 | # ============================================================================= 3 | # CONTENTS 4 | # ----------------------------------------------------------------------------- 5 | # phlgit_rebase 6 | # 7 | # Public Functions: 8 | # onto_upstream 9 | # 10 | # ----------------------------------------------------------------------------- 11 | # (this contents block is generated, edits will be lost) 12 | # ============================================================================= 13 | 14 | from __future__ import absolute_import 15 | from __future__ import division 16 | from __future__ import print_function 17 | 18 | 19 | def onto_upstream(repo, upstream): 20 | """Rebase HEAD onto the supplied 'upstream'. 21 | 22 | :repo: a callable supporting git commands, e.g. repo("status") 23 | :upstream: the string name of the branch to rebase onto 24 | :returns: None 25 | 26 | """ 27 | repo('rebase', upstream) 28 | 29 | 30 | # ----------------------------------------------------------------------------- 31 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 32 | # 33 | # Licensed under the Apache License, Version 2.0 (the "License"); 34 | # you may not use this file except in compliance with the License. 35 | # You may obtain a copy of the License at 36 | # 37 | # http://www.apache.org/licenses/LICENSE-2.0 38 | # 39 | # Unless required by applicable law or agreed to in writing, software 40 | # distributed under the License is distributed on an "AS IS" BASIS, 41 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 42 | # See the License for the specific language governing permissions and 43 | # limitations under the License. 44 | # ------------------------------ END-OF-FILE ---------------------------------- 45 | -------------------------------------------------------------------------------- /py/phl/phlgit_revlist.py: -------------------------------------------------------------------------------- 1 | """Wrapper around 'git rev-list'.""" 2 | # ============================================================================= 3 | # CONTENTS 4 | # ----------------------------------------------------------------------------- 5 | # phlgit_revlist 6 | # 7 | # Public Functions: 8 | # commits 9 | # 10 | # ----------------------------------------------------------------------------- 11 | # (this contents block is generated, edits will be lost) 12 | # ============================================================================= 13 | 14 | from __future__ import absolute_import 15 | from __future__ import division 16 | from __future__ import print_function 17 | 18 | 19 | def commits(repo, *commits): 20 | """Return list of strings of commit SHA1s reachable from each in 'commits'. 21 | 22 | :repo: a callable supporting git commands, e.g. repo("status") 23 | :*commits: string names of commits to traverse 24 | :returns: list of string commit SHA1s 25 | 26 | """ 27 | return repo('rev-list', *commits).splitlines() 28 | 29 | 30 | # ----------------------------------------------------------------------------- 31 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 32 | # 33 | # Licensed under the Apache License, Version 2.0 (the "License"); 34 | # you may not use this file except in compliance with the License. 35 | # You may obtain a copy of the License at 36 | # 37 | # http://www.apache.org/licenses/LICENSE-2.0 38 | # 39 | # Unless required by applicable law or agreed to in writing, software 40 | # distributed under the License is distributed on an "AS IS" BASIS, 41 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 42 | # See the License for the specific language governing permissions and 43 | # limitations under the License. 44 | # ------------------------------ END-OF-FILE ---------------------------------- 45 | -------------------------------------------------------------------------------- /py/phl/phlgit_revparse.py: -------------------------------------------------------------------------------- 1 | """Wrapper around 'git rev-parse'.""" 2 | # ============================================================================= 3 | # CONTENTS 4 | # ----------------------------------------------------------------------------- 5 | # phlgit_revparse 6 | # 7 | # Public Classes: 8 | # Error 9 | # 10 | # Public Functions: 11 | # get_sha1_or_none 12 | # get_sha1 13 | # 14 | # ----------------------------------------------------------------------------- 15 | # (this contents block is generated, edits will be lost) 16 | # ============================================================================= 17 | 18 | from __future__ import absolute_import 19 | from __future__ import division 20 | from __future__ import print_function 21 | 22 | 23 | class Error(Exception): 24 | pass 25 | 26 | 27 | def get_sha1_or_none(repo, ref): 28 | """Return string of the ref's commit hash if valid, else None. 29 | 30 | :repo: a callable supporting git commands, e.g. repo("status") 31 | :ref: string of the reference to parse 32 | :returns: string of the ref's commit hash if valid, else None. 33 | 34 | """ 35 | commit = repo("rev-parse", "--revs-only", ref).strip() 36 | return commit if commit else None 37 | 38 | 39 | def get_sha1(repo, ref): 40 | """Return string of the ref's commit hash. 41 | 42 | Raise if the ref is invalid. 43 | 44 | :repo: a callable supporting git commands, e.g. repo("status") 45 | :ref: string of the reference to parse 46 | :returns: string of the ref's commit hash 47 | 48 | """ 49 | commit = get_sha1_or_none(repo, ref) 50 | if commit is None: 51 | raise Error("ref '{}' is invalid.".format(ref)) 52 | return commit 53 | 54 | 55 | # ----------------------------------------------------------------------------- 56 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 57 | # 58 | # Licensed under the Apache License, Version 2.0 (the "License"); 59 | # you may not use this file except in compliance with the License. 60 | # You may obtain a copy of the License at 61 | # 62 | # http://www.apache.org/licenses/LICENSE-2.0 63 | # 64 | # Unless required by applicable law or agreed to in writing, software 65 | # distributed under the License is distributed on an "AS IS" BASIS, 66 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 67 | # See the License for the specific language governing permissions and 68 | # limitations under the License. 69 | # ------------------------------ END-OF-FILE ---------------------------------- 70 | -------------------------------------------------------------------------------- /py/phl/phlgit_show.py: -------------------------------------------------------------------------------- 1 | """Wrapper around 'git show'.""" 2 | # ============================================================================= 3 | # CONTENTS 4 | # ----------------------------------------------------------------------------- 5 | # phlgit_show 6 | # 7 | # Public Functions: 8 | # object_ 9 | # file_on_ref 10 | # 11 | # ----------------------------------------------------------------------------- 12 | # (this contents block is generated, edits will be lost) 13 | # ============================================================================= 14 | 15 | from __future__ import absolute_import 16 | from __future__ import division 17 | from __future__ import print_function 18 | 19 | 20 | def object_(repo, ref): 21 | """Return the content of the specified object. 22 | 23 | :repo: a callable supporting git commands, e.g. repo("status") 24 | :ref: the ref of the object, e.g. 'origin/master', 'ed3a1', etc. 25 | :returns: the contents of the object 26 | 27 | """ 28 | return repo('show', ref) 29 | 30 | 31 | def file_on_ref(repo, path, ref): 32 | """Return the content of the file at specified 'path' on branch 'ref'. 33 | 34 | Raise if the file or ref does not exist. 35 | 36 | :repo: a callable supporting git commands, e.g. repo("status") 37 | :path: the string path to the file on the branch, e.g. 'src/main.cpp' 38 | :ref: the string ref of the branch, e.g. 'feature/red_button' 39 | :returns: the string contents of the file 40 | 41 | """ 42 | return repo('show', '{}:{}'.format(ref, path)) 43 | 44 | 45 | # ----------------------------------------------------------------------------- 46 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 47 | # 48 | # Licensed under the Apache License, Version 2.0 (the "License"); 49 | # you may not use this file except in compliance with the License. 50 | # You may obtain a copy of the License at 51 | # 52 | # http://www.apache.org/licenses/LICENSE-2.0 53 | # 54 | # Unless required by applicable law or agreed to in writing, software 55 | # distributed under the License is distributed on an "AS IS" BASIS, 56 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 57 | # See the License for the specific language governing permissions and 58 | # limitations under the License. 59 | # ------------------------------ END-OF-FILE ---------------------------------- 60 | -------------------------------------------------------------------------------- /py/phl/phlgit_showref.py: -------------------------------------------------------------------------------- 1 | """Wrapper around 'git show-ref'.""" 2 | # ============================================================================= 3 | # CONTENTS 4 | # ----------------------------------------------------------------------------- 5 | # phlgit_showref 6 | # 7 | # Public Functions: 8 | # names 9 | # hash_ref_pairs 10 | # 11 | # ----------------------------------------------------------------------------- 12 | # (this contents block is generated, edits will be lost) 13 | # ============================================================================= 14 | 15 | from __future__ import absolute_import 16 | from __future__ import division 17 | from __future__ import print_function 18 | 19 | 20 | def names(repo): 21 | """Return a list of string names of the refs in the supplied repo. 22 | 23 | :repo: a callable supporting git commands, e.g. repo("status") 24 | :returns: a list of string names 25 | 26 | """ 27 | result = [name for sha1, name in hash_ref_pairs(repo)] 28 | return result 29 | 30 | 31 | def hash_ref_pairs(repo): 32 | """Return a list of (sha1, name) tuples from the list of refs in 'repo'. 33 | 34 | :repo: a callable supporting git commands, e.g. repo("status") 35 | :returns: a list of (sha1, name) 36 | 37 | """ 38 | result = [line.split() for line in repo('show-ref').splitlines()] 39 | return result 40 | 41 | 42 | # ----------------------------------------------------------------------------- 43 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 44 | # 45 | # Licensed under the Apache License, Version 2.0 (the "License"); 46 | # you may not use this file except in compliance with the License. 47 | # You may obtain a copy of the License at 48 | # 49 | # http://www.apache.org/licenses/LICENSE-2.0 50 | # 51 | # Unless required by applicable law or agreed to in writing, software 52 | # distributed under the License is distributed on an "AS IS" BASIS, 53 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 54 | # See the License for the specific language governing permissions and 55 | # limitations under the License. 56 | # ------------------------------ END-OF-FILE ---------------------------------- 57 | -------------------------------------------------------------------------------- /py/phl/phlmail_mocksender__t.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | from __future__ import division 3 | from __future__ import print_function 4 | 5 | import unittest 6 | 7 | import phlmail_mocksender 8 | 9 | 10 | class Test(unittest.TestCase): 11 | 12 | def test_empty(self): 13 | mailsender = phlmail_mocksender.MailSender() 14 | self.assertEqual(len(mailsender.mailboxes), 0) 15 | self.assertEqual(len(mailsender.mails), 0) 16 | 17 | def test_oneTo(self): 18 | mailsender = phlmail_mocksender.MailSender() 19 | subject = "subject" 20 | message = "message" 21 | to = "someone@server.test" 22 | mailsender.send(subject, message, [to]) 23 | self.assertEqual(len(mailsender.mailboxes), 1) 24 | self.assertEqual(len(mailsender.mails), 1) 25 | self.assertEqual(mailsender.mailboxes[to][0], mailsender.mails[0]) 26 | mail = mailsender.mails[0] 27 | self.assertEqual(mail.subject, subject) 28 | self.assertEqual(mail.message, message) 29 | self.assertEqual(mail.to_addresses, [to]) 30 | self.assertIsNone(mail.cc_addresses) 31 | 32 | 33 | # ----------------------------------------------------------------------------- 34 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 35 | # 36 | # Licensed under the Apache License, Version 2.0 (the "License"); 37 | # you may not use this file except in compliance with the License. 38 | # You may obtain a copy of the License at 39 | # 40 | # http://www.apache.org/licenses/LICENSE-2.0 41 | # 42 | # Unless required by applicable law or agreed to in writing, software 43 | # distributed under the License is distributed on an "AS IS" BASIS, 44 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 45 | # See the License for the specific language governing permissions and 46 | # limitations under the License. 47 | # ------------------------------ END-OF-FILE ---------------------------------- 48 | -------------------------------------------------------------------------------- /py/phl/phlmail_sender.py: -------------------------------------------------------------------------------- 1 | """A mail sender that sends mail via a configured sendmail.""" 2 | # ============================================================================= 3 | # CONTENTS 4 | # ----------------------------------------------------------------------------- 5 | # phlmail_sender 6 | # 7 | # Public Classes: 8 | # MailSender 9 | # .send 10 | # 11 | # ----------------------------------------------------------------------------- 12 | # (this contents block is generated, edits will be lost) 13 | # ============================================================================= 14 | 15 | from __future__ import absolute_import 16 | from __future__ import division 17 | from __future__ import print_function 18 | 19 | import phlmail_format 20 | 21 | 22 | class MailSender(object): 23 | 24 | """A mail sender that sends mail via a configured sendmail.""" 25 | 26 | def __init__(self, sendmail, from_email): 27 | """Setup to send mail with 'sendmail' from 'from_email'. 28 | 29 | :sendmail: the sendmail instance to send with, e.g. a phlsys_sendmail 30 | :from_email: the address to send from 31 | 32 | """ 33 | self._sendmail = sendmail 34 | self._from_email = from_email 35 | 36 | def send(self, subject, message, to_addresses, cc_addresses=None): 37 | mime = phlmail_format.text( 38 | subject, message, self._from_email, to_addresses, cc_addresses) 39 | self._sendmail.send(mime) 40 | 41 | 42 | # ----------------------------------------------------------------------------- 43 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 44 | # 45 | # Licensed under the Apache License, Version 2.0 (the "License"); 46 | # you may not use this file except in compliance with the License. 47 | # You may obtain a copy of the License at 48 | # 49 | # http://www.apache.org/licenses/LICENSE-2.0 50 | # 51 | # Unless required by applicable law or agreed to in writing, software 52 | # distributed under the License is distributed on an "AS IS" BASIS, 53 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 54 | # See the License for the specific language governing permissions and 55 | # limitations under the License. 56 | # ------------------------------ END-OF-FILE ---------------------------------- 57 | -------------------------------------------------------------------------------- /py/phl/phlsys_arcconfig.py: -------------------------------------------------------------------------------- 1 | """Wrapper to integrate with Arcanist's .arcconfig file.""" 2 | # ============================================================================= 3 | # CONTENTS 4 | # ----------------------------------------------------------------------------- 5 | # phlsys_arcconfig 6 | # 7 | # Public Functions: 8 | # find_arcconfig 9 | # load 10 | # get_arcconfig 11 | # 12 | # ----------------------------------------------------------------------------- 13 | # (this contents block is generated, edits will be lost) 14 | # ============================================================================= 15 | 16 | from __future__ import absolute_import 17 | from __future__ import division 18 | from __future__ import print_function 19 | 20 | import json 21 | import os 22 | 23 | 24 | def _parent_dir(path): 25 | return os.path.abspath(os.path.join(path, os.pardir)) 26 | 27 | 28 | def find_arcconfig(): 29 | path = None 30 | nextpath = os.getcwd() 31 | while path != nextpath: 32 | path, nextpath = nextpath, _parent_dir(nextpath) 33 | config_path = os.path.join(path, ".arcconfig") 34 | if os.path.isfile(config_path): 35 | return config_path 36 | return None 37 | 38 | 39 | def load(path): 40 | with open(path) as f: 41 | return json.load(f) 42 | 43 | 44 | def get_arcconfig(): 45 | return load(find_arcconfig()) 46 | 47 | 48 | # ----------------------------------------------------------------------------- 49 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 50 | # 51 | # Licensed under the Apache License, Version 2.0 (the "License"); 52 | # you may not use this file except in compliance with the License. 53 | # You may obtain a copy of the License at 54 | # 55 | # http://www.apache.org/licenses/LICENSE-2.0 56 | # 57 | # Unless required by applicable law or agreed to in writing, software 58 | # distributed under the License is distributed on an "AS IS" BASIS, 59 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 60 | # See the License for the specific language governing permissions and 61 | # limitations under the License. 62 | # ------------------------------ END-OF-FILE ---------------------------------- 63 | -------------------------------------------------------------------------------- /py/phl/phlsys_arcrc.py: -------------------------------------------------------------------------------- 1 | """Wrapper to integrate with Arcanist's ~/.arcrc file.""" 2 | # ============================================================================= 3 | # CONTENTS 4 | # ----------------------------------------------------------------------------- 5 | # phlsys_arcrc 6 | # 7 | # Public Functions: 8 | # find_arcrc 9 | # load 10 | # get_arcrc 11 | # get_host 12 | # 13 | # ----------------------------------------------------------------------------- 14 | # (this contents block is generated, edits will be lost) 15 | # ============================================================================= 16 | 17 | from __future__ import absolute_import 18 | from __future__ import division 19 | from __future__ import print_function 20 | 21 | import json 22 | import os.path 23 | 24 | import phlsys_conduit 25 | 26 | 27 | def find_arcrc(): 28 | home = os.path.expanduser("~") 29 | path = os.path.join(home, ".arcrc") 30 | if os.path.isfile(path): 31 | return path 32 | return None 33 | 34 | 35 | def load(path): 36 | with open(path) as f: 37 | return json.load(f) 38 | 39 | 40 | def get_arcrc(): 41 | return load(find_arcrc()) 42 | 43 | 44 | def get_host(arcrc, host): 45 | normalised = phlsys_conduit.make_conduit_uri(host) 46 | return arcrc["hosts"].get(normalised, None) 47 | 48 | 49 | # ----------------------------------------------------------------------------- 50 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 51 | # 52 | # Licensed under the Apache License, Version 2.0 (the "License"); 53 | # you may not use this file except in compliance with the License. 54 | # You may obtain a copy of the License at 55 | # 56 | # http://www.apache.org/licenses/LICENSE-2.0 57 | # 58 | # Unless required by applicable law or agreed to in writing, software 59 | # distributed under the License is distributed on an "AS IS" BASIS, 60 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 61 | # See the License for the specific language governing permissions and 62 | # limitations under the License. 63 | # ------------------------------ END-OF-FILE ---------------------------------- 64 | -------------------------------------------------------------------------------- /py/phl/phlsys_git.py: -------------------------------------------------------------------------------- 1 | """Wrapper to call git, with working directory.""" 2 | # ============================================================================= 3 | # CONTENTS 4 | # ----------------------------------------------------------------------------- 5 | # phlsys_git 6 | # 7 | # Public Classes: 8 | # Repo 9 | # .working_dir 10 | # 11 | # ----------------------------------------------------------------------------- 12 | # (this contents block is generated, edits will be lost) 13 | # ============================================================================= 14 | 15 | from __future__ import absolute_import 16 | from __future__ import division 17 | from __future__ import print_function 18 | 19 | import os 20 | 21 | import phlsys_subprocess 22 | 23 | 24 | class Repo(object): 25 | 26 | def __init__(self, workingDir): 27 | self._workingDir = os.path.abspath(workingDir) 28 | 29 | # def __call__(*args, stdin=None): <-- supported in Python 3 30 | def __call__(self, *args, **kwargs): 31 | stdin = kwargs.pop("stdin", None) 32 | assert(not kwargs) 33 | result = phlsys_subprocess.run( 34 | 'git', *args, 35 | stdin=stdin, workingDir=self._workingDir) 36 | return result.stdout 37 | 38 | @property 39 | def working_dir(self): 40 | return self._workingDir 41 | 42 | 43 | # ----------------------------------------------------------------------------- 44 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 45 | # 46 | # Licensed under the Apache License, Version 2.0 (the "License"); 47 | # you may not use this file except in compliance with the License. 48 | # You may obtain a copy of the License at 49 | # 50 | # http://www.apache.org/licenses/LICENSE-2.0 51 | # 52 | # Unless required by applicable law or agreed to in writing, software 53 | # distributed under the License is distributed on an "AS IS" BASIS, 54 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 55 | # See the License for the specific language governing permissions and 56 | # limitations under the License. 57 | # ------------------------------ END-OF-FILE ---------------------------------- 58 | -------------------------------------------------------------------------------- /py/phl/phlsys_git__it.py: -------------------------------------------------------------------------------- 1 | """Test suite for phlsys_git.""" 2 | # ============================================================================= 3 | # TEST PLAN 4 | # ----------------------------------------------------------------------------- 5 | # Here we detail the things we are concerned to test and specify which tests 6 | # cover those concerns. 7 | # 8 | # Concerns: 9 | # TODO 10 | # ----------------------------------------------------------------------------- 11 | # Tests: 12 | # TODO 13 | # ============================================================================= 14 | 15 | from __future__ import absolute_import 16 | from __future__ import division 17 | from __future__ import print_function 18 | 19 | import unittest 20 | 21 | import phlsys_git 22 | import phlsys_subprocess 23 | 24 | 25 | class Test(unittest.TestCase): 26 | 27 | def setUp(self): 28 | pass 29 | 30 | def tearDown(self): 31 | pass 32 | 33 | def test_can_commit(self): 34 | # TODO: make this more portable with shutil etc. 35 | run = phlsys_subprocess.run 36 | runCommands = phlsys_subprocess.run_commands 37 | path = "phlsys_git_TestGitContext" 38 | runCommands("mkdir " + path) 39 | run("git", "init", workingDir=path) 40 | repo = phlsys_git.Repo(path) 41 | runCommands("touch " + path + "/README") 42 | repo("add", "README") 43 | repo("commit", "-m", "initial commit") 44 | runCommands("rm -rf " + path) 45 | 46 | 47 | # ----------------------------------------------------------------------------- 48 | # Copyright (C) 2013-2015 Bloomberg Finance L.P. 49 | # 50 | # Licensed under the Apache License, Version 2.0 (the "License"); 51 | # you may not use this file except in compliance with the License. 52 | # You may obtain a copy of the License at 53 | # 54 | # http://www.apache.org/licenses/LICENSE-2.0 55 | # 56 | # Unless required by applicable law or agreed to in writing, software 57 | # distributed under the License is distributed on an "AS IS" BASIS, 58 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 59 | # See the License for the specific language governing permissions and 60 | # limitations under the License. 61 | # ------------------------------ END-OF-FILE ---------------------------------- 62 | -------------------------------------------------------------------------------- /py/phl/phlsys_string.py: -------------------------------------------------------------------------------- 1 | """String utility functions.""" 2 | # ============================================================================= 3 | # CONTENTS 4 | # ----------------------------------------------------------------------------- 5 | # phlsys_string 6 | # 7 | # Public Functions: 8 | # after_prefix 9 | # 10 | # ----------------------------------------------------------------------------- 11 | # (this contents block is generated, edits will be lost) 12 | # ============================================================================= 13 | 14 | from __future__ import absolute_import 15 | from __future__ import division 16 | from __future__ import print_function 17 | 18 | 19 | def after_prefix(string, prefix): 20 | """Return 'string' with 'prefix' removed. 21 | 22 | If 'string' does not start with 'prefix' then None is returned. 23 | 24 | Usage examples: 25 | 26 | >>> after_prefix('dog/cat/', 'dog/') 27 | 'cat/' 28 | 29 | >>> after_prefix('dog/cat/', 'mouse/') 30 | 31 | :string: string to operate on 32 | :prefix: string prefix to remove 33 | :returns: string representing 'string' with 'prefix' removed or None 34 | 35 | """ 36 | if string.startswith(prefix): 37 | return string[len(prefix):] 38 | return None 39 | 40 | 41 | # ----------------------------------------------------------------------------- 42 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 43 | # 44 | # Licensed under the Apache License, Version 2.0 (the "License"); 45 | # you may not use this file except in compliance with the License. 46 | # You may obtain a copy of the License at 47 | # 48 | # http://www.apache.org/licenses/LICENSE-2.0 49 | # 50 | # Unless required by applicable law or agreed to in writing, software 51 | # distributed under the License is distributed on an "AS IS" BASIS, 52 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 53 | # See the License for the specific language governing permissions and 54 | # limitations under the License. 55 | # ------------------------------ END-OF-FILE ---------------------------------- 56 | -------------------------------------------------------------------------------- /py/phl/phlsys_subcommand.py: -------------------------------------------------------------------------------- 1 | """Help to wrap up modules as subcommands.""" 2 | # ============================================================================= 3 | # CONTENTS 4 | # ----------------------------------------------------------------------------- 5 | # phlsys_subcommand 6 | # 7 | # Public Functions: 8 | # setup_parser 9 | # 10 | # ----------------------------------------------------------------------------- 11 | # (this contents block is generated, edits will be lost) 12 | # ============================================================================= 13 | 14 | from __future__ import absolute_import 15 | from __future__ import division 16 | from __future__ import print_function 17 | 18 | import argparse 19 | 20 | 21 | def setup_parser(name, module, subparsers): 22 | doc = module.__doc__ 23 | docSubject = doc.splitlines()[0] 24 | docEpilog = '\n'.join(doc.splitlines()[1:]) 25 | parser = subparsers.add_parser( 26 | name, 27 | formatter_class=argparse.RawDescriptionHelpFormatter, 28 | help=docSubject, 29 | description=docSubject, 30 | epilog=docEpilog, 31 | fromfile_prefix_chars=module.getFromfilePrefixChars()) 32 | module.setupParser(parser) 33 | parser.set_defaults(func=module.process) 34 | 35 | 36 | # ----------------------------------------------------------------------------- 37 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 38 | # 39 | # Licensed under the Apache License, Version 2.0 (the "License"); 40 | # you may not use this file except in compliance with the License. 41 | # You may obtain a copy of the License at 42 | # 43 | # http://www.apache.org/licenses/LICENSE-2.0 44 | # 45 | # Unless required by applicable law or agreed to in writing, software 46 | # distributed under the License is distributed on an "AS IS" BASIS, 47 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 48 | # See the License for the specific language governing permissions and 49 | # limitations under the License. 50 | # ------------------------------ END-OF-FILE ---------------------------------- 51 | -------------------------------------------------------------------------------- /py/phl/phlsys_verboseerrorfilter.py: -------------------------------------------------------------------------------- 1 | """Filter for log handlers to exclude verbose error messages.""" 2 | # ============================================================================= 3 | # CONTENTS 4 | # ----------------------------------------------------------------------------- 5 | # phlsys_verboseerrorfilter 6 | # 7 | # Public Classes: 8 | # VerboseErrorFilter 9 | # .filter 10 | # 11 | # Public Functions: 12 | # make_filter 13 | # 14 | # ----------------------------------------------------------------------------- 15 | # (this contents block is generated, edits will be lost) 16 | # ============================================================================= 17 | 18 | from __future__ import absolute_import 19 | from __future__ import division 20 | from __future__ import print_function 21 | 22 | import logging 23 | 24 | 25 | class VerboseErrorFilter(logging.Filter): 26 | 27 | def filter(self, record): 28 | if record.levelno == logging.ERROR and \ 29 | record.getMessage().startswith("VERBOSE MESSAGE"): 30 | return False 31 | else: 32 | return True 33 | 34 | 35 | def make_filter(): 36 | return VerboseErrorFilter() 37 | 38 | # ----------------------------------------------------------------------------- 39 | # Copyright (C) 2015 Bloomberg Finance L.P. 40 | # 41 | # Licensed under the Apache License, Version 2.0 (the "License"); 42 | # you may not use this file except in compliance with the License. 43 | # You may obtain a copy of the License at 44 | # 45 | # http://www.apache.org/licenses/LICENSE-2.0 46 | # 47 | # Unless required by applicable law or agreed to in writing, software 48 | # distributed under the License is distributed on an "AS IS" BASIS, 49 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 50 | # See the License for the specific language governing permissions and 51 | # limitations under the License. 52 | # ------------------------------ END-OF-FILE ---------------------------------- 53 | -------------------------------------------------------------------------------- /py/phl/phlsys_web.py: -------------------------------------------------------------------------------- 1 | """Tools for managing a web server.""" 2 | # ============================================================================= 3 | # CONTENTS 4 | # ----------------------------------------------------------------------------- 5 | # phlsys_web 6 | # 7 | # Public Classes: 8 | # SimpleWebServer 9 | # .close 10 | # 11 | # Public Functions: 12 | # pick_free_port 13 | # 14 | # ----------------------------------------------------------------------------- 15 | # (this contents block is generated, edits will be lost) 16 | # ============================================================================= 17 | 18 | from __future__ import absolute_import 19 | from __future__ import division 20 | from __future__ import print_function 21 | 22 | import socket 23 | import subprocess 24 | 25 | import phlsys_pid 26 | 27 | 28 | def pick_free_port(): 29 | sock = socket.socket() 30 | sock.bind(('', 0)) 31 | port = sock.getsockname()[1] 32 | sock.close() 33 | return port 34 | 35 | 36 | class SimpleWebServer(object): 37 | 38 | def __init__(self, root_path, port): 39 | self._root_path = root_path 40 | self._process = subprocess.Popen( 41 | ['python', '-m', 'SimpleHTTPServer', str(port)], 42 | cwd=root_path) 43 | 44 | def close(self): 45 | pid = self._process.pid 46 | phlsys_pid.request_terminate(pid) 47 | self._process.wait() 48 | # ----------------------------------------------------------------------------- 49 | # Copyright (C) 2015 Bloomberg Finance L.P. 50 | # 51 | # Licensed under the Apache License, Version 2.0 (the "License"); 52 | # you may not use this file except in compliance with the License. 53 | # You may obtain a copy of the License at 54 | # 55 | # http://www.apache.org/licenses/LICENSE-2.0 56 | # 57 | # Unless required by applicable law or agreed to in writing, software 58 | # distributed under the License is distributed on an "AS IS" BASIS, 59 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 60 | # See the License for the specific language governing permissions and 61 | # limitations under the License. 62 | # ------------------------------ END-OF-FILE ---------------------------------- 63 | -------------------------------------------------------------------------------- /py/phl/phlsys_workingdircommand.py: -------------------------------------------------------------------------------- 1 | """Run a system command in its own working directory.""" 2 | # ============================================================================= 3 | # CONTENTS 4 | # ----------------------------------------------------------------------------- 5 | # phlsys_workingdircommand 6 | # 7 | # Public Classes: 8 | # CommandWithWorkingDirectory 9 | # 10 | # ----------------------------------------------------------------------------- 11 | # (this contents block is generated, edits will be lost) 12 | # ============================================================================= 13 | 14 | from __future__ import absolute_import 15 | from __future__ import division 16 | from __future__ import print_function 17 | 18 | import os 19 | 20 | import phlsys_subprocess 21 | 22 | 23 | class CommandWithWorkingDirectory(object): 24 | 25 | def __init__(self, command_path, working_dir_path): 26 | self._working_dir_path = os.path.abspath(working_dir_path) 27 | self._command_path = os.path.abspath(command_path) 28 | 29 | def __call__(self, *args, **kwargs): 30 | stdin = kwargs.pop("stdin", None) 31 | assert not kwargs 32 | result = phlsys_subprocess.run( 33 | self._command_path, *args, 34 | stdin=stdin, workingDir=self._working_dir_path) 35 | return result.stdout 36 | 37 | 38 | # ----------------------------------------------------------------------------- 39 | # Copyright (C) 2015 Bloomberg Finance L.P. 40 | # 41 | # Licensed under the Apache License, Version 2.0 (the "License"); 42 | # you may not use this file except in compliance with the License. 43 | # You may obtain a copy of the License at 44 | # 45 | # http://www.apache.org/licenses/LICENSE-2.0 46 | # 47 | # Unless required by applicable law or agreed to in writing, software 48 | # distributed under the License is distributed on an "AS IS" BASIS, 49 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 50 | # See the License for the specific language governing permissions and 51 | # limitations under the License. 52 | # ------------------------------ END-OF-FILE ---------------------------------- 53 | -------------------------------------------------------------------------------- /py/pig/README.md: -------------------------------------------------------------------------------- 1 | # pig 2 | * `pigcmd_phabping.py` - 3 | phab-ping - a Phabricator conduit.ping wrapper. 4 | 5 | ----- 6 | *please note: this file is generated, edits will be lost* 7 | -------------------------------------------------------------------------------- /py/pox/README.md: -------------------------------------------------------------------------------- 1 | # pox 2 | * `poxcmd_conduitproxy.py` - 3 | conduit-proxy - a webserver for proxying connections to conduit. 4 | 5 | ----- 6 | *please note: this file is generated, edits will be lost* 7 | -------------------------------------------------------------------------------- /testbed/.arcconfig: -------------------------------------------------------------------------------- 1 | { 2 | "project_id": "http://github.com/bloomberg/phabricator-tools", 3 | "conduit_uri": "http://127.0.0.1" 4 | } 5 | -------------------------------------------------------------------------------- /testbed/.gitignore: -------------------------------------------------------------------------------- 1 | test/ 2 | test2/ 3 | test2_origin/ 4 | test_origin/ 5 | touches 6 | -------------------------------------------------------------------------------- /testbed/arcyd-tester/smoketest.sh: -------------------------------------------------------------------------------- 1 | trap "echo 'FAILED!'; exit 1" ERR 2 | set -x # echo all commands to the console for easier debugging 3 | set -u # treat usage of undefined variables as an error 4 | 5 | # cd to the dir of this script, so paths are relative 6 | cd "$(dirname "$0")" 7 | 8 | arcyd_tester='../../proto/arcyd-tester' 9 | 10 | ${arcyd_tester} --help 11 | ${arcyd_tester} 12 | 13 | # ----------------------------------------------------------------------------- 14 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 15 | # 16 | # Licensed under the Apache License, Version 2.0 (the "License"); 17 | # you may not use this file except in compliance with the License. 18 | # You may obtain a copy of the License at 19 | # 20 | # http://www.apache.org/licenses/LICENSE-2.0 21 | # 22 | # Unless required by applicable law or agreed to in writing, software 23 | # distributed under the License is distributed on an "AS IS" BASIS, 24 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | # See the License for the specific language governing permissions and 26 | # limitations under the License. 27 | # ------------------------------ END-OF-FILE ---------------------------------- 28 | -------------------------------------------------------------------------------- /testbed/arcyd/logerror: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | usage='usage: on_system_error.sh IDENTIFIER DETAIL' 3 | 4 | # look at py/abd/abdt_errident.py for a list of possible error identifiers 5 | 6 | # the identifier is a short string to identify the tryloop that failed 7 | # the description should contain enough context to begin debugging the error 8 | 9 | if [ $# -ne 2 ]; then 10 | echo "${usage}" 11 | exit 2 12 | fi 13 | 14 | identifier=$1 15 | multiline_detail=$2 16 | detail=$(echo "${multiline_detail}" | tr "\n" " ") 17 | 18 | echo "on_system_error:" 19 | echo " identifier: ${identifier}" 20 | echo " detail: ${detail}" 21 | 22 | echo ========================================================== >> logerror.txt 23 | echo -------------------------- LOG ERROR --------------------- >> logerror.txt 24 | echo "identifier: $1" >> logerror.txt 25 | echo "description: $2" >> logerror.txt 26 | echo ========================================================== >> logerror.txt 27 | echo >> logerror.txt 28 | 29 | 30 | # ----------------------------------------------------------------------------- 31 | # Copyright (C) 2014 Bloomberg Finance L.P. 32 | # 33 | # Licensed under the Apache License, Version 2.0 (the "License"); 34 | # you may not use this file except in compliance with the License. 35 | # You may obtain a copy of the License at 36 | # 37 | # http://www.apache.org/licenses/LICENSE-2.0 38 | # 39 | # Unless required by applicable law or agreed to in writing, software 40 | # distributed under the License is distributed on an "AS IS" BASIS, 41 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 42 | # See the License for the specific language governing permissions and 43 | # limitations under the License. 44 | # ------------------------------ END-OF-FILE ---------------------------------- 45 | -------------------------------------------------------------------------------- /testbed/arcyd/loop_test.sh: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # looping test for Arcyd, aimed at exercising the whole cycle 3 | ############################################################################### 4 | 5 | # cd to the dir of this script, so paths are relative 6 | cd "$(dirname "$0")" 7 | 8 | ./_loop.sh "$(pwd)/../../proto/arcyd" 9 | # ----------------------------------------------------------------------------- 10 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 11 | # 12 | # Licensed under the Apache License, Version 2.0 (the "License"); 13 | # you may not use this file except in compliance with the License. 14 | # You may obtain a copy of the License at 15 | # 16 | # http://www.apache.org/licenses/LICENSE-2.0 17 | # 18 | # Unless required by applicable law or agreed to in writing, software 19 | # distributed under the License is distributed on an "AS IS" BASIS, 20 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | # See the License for the specific language governing permissions and 22 | # limitations under the License. 23 | # ------------------------------ END-OF-FILE ---------------------------------- 24 | -------------------------------------------------------------------------------- /testbed/arcyd/poke_loop.sh: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # continuously poke reviews into arcyd and accept them 3 | ############################################################################### 4 | 5 | set -e 6 | trap "echo FAILED!; exit 1" EXIT 7 | 8 | basedir=$(dirname "$0") # directory the script lives in 9 | arcyon="${basedir}/../../bin/arcyon" 10 | 11 | phaburi="http://127.0.0.1" 12 | aliceuser='alice' 13 | alicecert=35yxukrjcltwgzfmgsnj2klc2jbrnzehqz3c36ijxnicwysv3xenxymwz532pyhimpxh\ 14 | 7jryynh32su2ajxahd3gp7qshyik2qwf6ntuim2acxvjnko6p2q4mhacpvugqou2wpmyqwj4hkchgc\ 15 | 5vh33lur723r4dexy5b3aj35v4v6ffork727ww5qk5yhhcmolbcqg3rxl6qpf53spn4aopneg\ 16 | gtb675hmpx3xya3et7jrowzlkl3yw3sktvdu 17 | 18 | arcyoncreds="--uri ${phaburi} --user ${aliceuser} --cert ${alicecert}" 19 | 20 | function poke() { 21 | feature=$(tr -dc "[:alpha:]" < /dev/urandom | head -c 8) 22 | branch="arcyd-review/${feature}/master" 23 | echo poke feature ${feature} 24 | git checkout -b ${branch} origin/master 25 | touch ${feature} 26 | git add . 27 | git commit -am "poked feature ${feature}" 28 | git push -u origin ${branch} 29 | sleep 1 30 | 31 | # find and accept most recent reviewable revision, if any 32 | revisionid=$(${arcyon} query --max-results 1 --statuses 'Needs Review' --format-type ids ${arcyoncreds}) 33 | if [ -n "$revisionid" ]; then 34 | ${arcyon} comment ${revisionid} --action accept ${arcyoncreds} 35 | fi 36 | } 37 | 38 | while [ ! -f __kill_poke__ ]; do poke; done 39 | 40 | trap - EXIT 41 | # ----------------------------------------------------------------------------- 42 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 43 | # 44 | # Licensed under the Apache License, Version 2.0 (the "License"); 45 | # you may not use this file except in compliance with the License. 46 | # You may obtain a copy of the License at 47 | # 48 | # http://www.apache.org/licenses/LICENSE-2.0 49 | # 50 | # Unless required by applicable law or agreed to in writing, software 51 | # distributed under the License is distributed on an "AS IS" BASIS, 52 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 53 | # See the License for the specific language governing permissions and 54 | # limitations under the License. 55 | # ------------------------------ END-OF-FILE ---------------------------------- 56 | -------------------------------------------------------------------------------- /testbed/arcyd/profile_arcyd.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | 3 | # The Python 'cProfile' module is widely available and can be invoked from the 4 | # command-line, this will record results in the 'arcyd.profile' file. 5 | python -m cProfile -o arcyd.profile $(which arcyd) start --foreground --no-loop 6 | 7 | # Analyse the profile interactively using the 'pstats' module 8 | echo 'Starting "pstats" to interactively analyse the profile.' 9 | echo 'Try typing this to get the top-30 functions by cumulative time:' 10 | echo 11 | echo ' sort cumulative' 12 | echo ' stats 30' 13 | echo 14 | echo 'Type "help" to list all commands.' 15 | python -m pstats arcyd.profile 16 | # ----------------------------------------------------------------------------- 17 | # Copyright (C) 2014 Bloomberg Finance L.P. 18 | # 19 | # Licensed under the Apache License, Version 2.0 (the "License"); 20 | # you may not use this file except in compliance with the License. 21 | # You may obtain a copy of the License at 22 | # 23 | # http://www.apache.org/licenses/LICENSE-2.0 24 | # 25 | # Unless required by applicable law or agreed to in writing, software 26 | # distributed under the License is distributed on an "AS IS" BASIS, 27 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 28 | # See the License for the specific language governing permissions and 29 | # limitations under the License. 30 | # ------------------------------ END-OF-FILE ---------------------------------- 31 | -------------------------------------------------------------------------------- /testbed/arcyd/run_maily.sh: -------------------------------------------------------------------------------- 1 | set -e # exit immediately on error 2 | ./maily --sender me@server.test --to you@server.test --subject hello --message body --sendmail-binary catchmail --sendmail-type catchmail 3 | ./maily --sender me@server.test --to you@server.test you2@server.test --subject hello --message body --sendmail-binary catchmail --sendmail-type catchmail 4 | ./maily --sender me@server.test --to you@server.test you2@server.test --cc cc@server.test --subject hello --message body --sendmail-binary catchmail --sendmail-type catchmail 5 | # ----------------------------------------------------------------------------- 6 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 7 | # 8 | # Licensed under the Apache License, Version 2.0 (the "License"); 9 | # you may not use this file except in compliance with the License. 10 | # You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | # ------------------------------ END-OF-FILE ---------------------------------- 20 | -------------------------------------------------------------------------------- /testbed/arcyd/savemail: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | echo ========================================================== >> savemail.txt 3 | echo -------------------------- SAVE MAIL --------------------- >> savemail.txt 4 | cat - >> savemail.txt 5 | echo ========================================================== >> savemail.txt 6 | echo >> savemail.txt 7 | # ----------------------------------------------------------------------------- 8 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 9 | # 10 | # Licensed under the Apache License, Version 2.0 (the "License"); 11 | # you may not use this file except in compliance with the License. 12 | # You may obtain a copy of the License at 13 | # 14 | # http://www.apache.org/licenses/LICENSE-2.0 15 | # 16 | # Unless required by applicable law or agreed to in writing, software 17 | # distributed under the License is distributed on an "AS IS" BASIS, 18 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | # See the License for the specific language governing permissions and 20 | # limitations under the License. 21 | # ------------------------------ END-OF-FILE ---------------------------------- 22 | -------------------------------------------------------------------------------- /testbed/arcyd/savereport: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | echo ========================================================== >> savereport.txt 3 | echo -------------------------- SAVE REPORT ------------------- >> savereport.txt 4 | cat - >> savereport.txt 5 | echo >> savereport.txt 6 | echo ========================================================== >> savereport.txt 7 | echo >> savereport.txt 8 | # ----------------------------------------------------------------------------- 9 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 10 | # 11 | # Licensed under the Apache License, Version 2.0 (the "License"); 12 | # you may not use this file except in compliance with the License. 13 | # You may obtain a copy of the License at 14 | # 15 | # http://www.apache.org/licenses/LICENSE-2.0 16 | # 17 | # Unless required by applicable law or agreed to in writing, software 18 | # distributed under the License is distributed on an "AS IS" BASIS, 19 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | # See the License for the specific language governing permissions and 21 | # limitations under the License. 22 | # ------------------------------ END-OF-FILE ---------------------------------- 23 | -------------------------------------------------------------------------------- /testbed/arcyd/savesystemerror.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | 3 | ############################################################################### 4 | # for use with arcyd, to simply save reported errors to disk 5 | ############################################################################### 6 | 7 | set +x # DONT echo all commands to the terminal 8 | set -e # exit with error if anything returns non-zero 9 | set -u # exit with error if we use an undefined variable 10 | 11 | echo $1 >> system_error.log 12 | echo $2 >> system_error.log 13 | echo >> system_error.log 14 | # ----------------------------------------------------------------------------- 15 | # Copyright (C) 2014 Bloomberg Finance L.P. 16 | # 17 | # Licensed under the Apache License, Version 2.0 (the "License"); 18 | # you may not use this file except in compliance with the License. 19 | # You may obtain a copy of the License at 20 | # 21 | # http://www.apache.org/licenses/LICENSE-2.0 22 | # 23 | # Unless required by applicable law or agreed to in writing, software 24 | # distributed under the License is distributed on an "AS IS" BASIS, 25 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 26 | # See the License for the specific language governing permissions and 27 | # limitations under the License. 28 | # ------------------------------ END-OF-FILE ---------------------------------- 29 | -------------------------------------------------------------------------------- /testbed/arcyd/unreliable_git_loop_test.sh: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # looping test for Arcyd, aimed at exercising the whole cycle 3 | ############################################################################### 4 | 5 | # cd to the dir of this script, so paths are relative 6 | cd "$(dirname "$0")" 7 | 8 | ./_loop.sh "python $(pwd)/bad_git_push_arcyd.py" 9 | # ----------------------------------------------------------------------------- 10 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 11 | # 12 | # Licensed under the Apache License, Version 2.0 (the "License"); 13 | # you may not use this file except in compliance with the License. 14 | # You may obtain a copy of the License at 15 | # 16 | # http://www.apache.org/licenses/LICENSE-2.0 17 | # 18 | # Unless required by applicable law or agreed to in writing, software 19 | # distributed under the License is distributed on an "AS IS" BASIS, 20 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | # See the License for the specific language governing permissions and 22 | # limitations under the License. 23 | # ------------------------------ END-OF-FILE ---------------------------------- 24 | -------------------------------------------------------------------------------- /testbed/arcyon/acceptance_tests.sh: -------------------------------------------------------------------------------- 1 | trap "echo 'FAILED!'; exit 1" ERR 2 | set -x 3 | 4 | # cd to the dir of this script, so paths are relative 5 | cd "$(dirname "$0")" 6 | 7 | arcyon='../../bin/arcyon' 8 | 9 | taskid=$($arcyon task-create 'exercise task-create' -d 'description' -p wish -o alice --ccs phab bob --format-id) 10 | 11 | # exercise task-query thoroughly 12 | $arcyon task-query 13 | $arcyon task-query --order priority 14 | $arcyon task-query --order created 15 | $arcyon task-query --order modified 16 | $arcyon task-query --order title 17 | $arcyon task-query --max-results 1 18 | $arcyon task-query --offset-results 1 19 | $arcyon task-query --offset-results 1 --max-results 1 20 | $arcyon task-query --priorities wish low normal high triage unbreak_now 21 | $arcyon task-query --priorities wish 22 | $arcyon task-query --priorities low 23 | $arcyon task-query --text description 24 | $arcyon task-query --status any 25 | $arcyon task-query --status open 26 | $arcyon task-query --status closed 27 | $arcyon task-query --status resolved 28 | $arcyon task-query --status wontfix 29 | $arcyon task-query --status invalid 30 | $arcyon task-query --status spite 31 | $arcyon task-query --status duplicate 32 | 33 | $arcyon query --branch mybranch 34 | 35 | # ----------------------------------------------------------------------------- 36 | # Copyright (C) 2014-2015 Bloomberg Finance L.P. 37 | # 38 | # Licensed under the Apache License, Version 2.0 (the "License"); 39 | # you may not use this file except in compliance with the License. 40 | # You may obtain a copy of the License at 41 | # 42 | # http://www.apache.org/licenses/LICENSE-2.0 43 | # 44 | # Unless required by applicable law or agreed to in writing, software 45 | # distributed under the License is distributed on an "AS IS" BASIS, 46 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 47 | # See the License for the specific language governing permissions and 48 | # limitations under the License. 49 | # ------------------------------ END-OF-FILE ---------------------------------- 50 | -------------------------------------------------------------------------------- /testbed/arcyon/diff1: -------------------------------------------------------------------------------- 1 | diff --git a/bin/arcyon b/bin/arcyon 2 | index ef65363..f338fbb 100755 3 | --- a/bin/arcyon 4 | +++ b/bin/arcyon 5 | @@ -51,6 +51,7 @@ import aoncmd_comment 6 | import aoncmd_createrevision 7 | import aoncmd_rawdiff 8 | import aoncmd_showconfig 9 | +import aoncmd_updaterevision 10 | import aoncmd_query 11 | 12 | 13 | @@ -68,6 +69,8 @@ def main(): 14 | phlsys_subcommand.setupParser("raw-diff", aoncmd_rawdiff, subparsers) 15 | phlsys_subcommand.setupParser( 16 | "create-revision", aoncmd_createrevision, subparsers) 17 | + phlsys_subcommand.setupParser( 18 | + "update-revision", aoncmd_updaterevision, subparsers) 19 | 20 | args = parser.parse_args() 21 | args.func(args) 22 | -------------------------------------------------------------------------------- /testbed/arcyon/diff2: -------------------------------------------------------------------------------- 1 | diff --git a/bin/arcyon b/bin/arcyon 2 | index ef65363..db705e0 100755 3 | --- a/bin/arcyon 4 | +++ b/bin/arcyon 5 | @@ -51,6 +51,7 @@ import aoncmd_comment 6 | import aoncmd_createrevision 7 | import aoncmd_rawdiff 8 | import aoncmd_showconfig 9 | +import aoncmd_updaterevision 10 | import aoncmd_query 11 | 12 | 13 | @@ -68,6 +69,8 @@ def main(): 14 | phlsys_subcommand.setupParser("raw-diff", aoncmd_rawdiff, subparsers) 15 | phlsys_subcommand.setupParser( 16 | "create-revision", aoncmd_createrevision, subparsers) 17 | + phlsys_subcommand.setupParser( 18 | + "update-revisionblah", aoncmd_updaterevision, subparsers) 19 | 20 | args = parser.parse_args() 21 | args.func(args) 22 | -------------------------------------------------------------------------------- /testbed/arcyon/exercise-query-parallel.sh: -------------------------------------------------------------------------------- 1 | for i in {1..10}; do 2 | ../../bin/arcyon query > /dev/null & 3 | done 4 | 5 | wait 6 | # ----------------------------------------------------------------------------- 7 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # ------------------------------ END-OF-FILE ---------------------------------- 21 | -------------------------------------------------------------------------------- /testbed/arcyon/exercise-query-serial.sh: -------------------------------------------------------------------------------- 1 | for i in {1..100}; do 2 | ../../bin/arcyon query > /dev/null 3 | done 4 | # ----------------------------------------------------------------------------- 5 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | # ------------------------------ END-OF-FILE ---------------------------------- 19 | -------------------------------------------------------------------------------- /testbed/barc/smoketest.sh: -------------------------------------------------------------------------------- 1 | trap "echo FAILED!; exit 1" ERR 2 | set -x 3 | 4 | barc='../../proto/barc' 5 | 6 | $barc -h 7 | $barc gc -h 8 | $barc list -h 9 | 10 | # ----------------------------------------------------------------------------- 11 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 12 | # 13 | # Licensed under the Apache License, Version 2.0 (the "License"); 14 | # you may not use this file except in compliance with the License. 15 | # You may obtain a copy of the License at 16 | # 17 | # http://www.apache.org/licenses/LICENSE-2.0 18 | # 19 | # Unless required by applicable law or agreed to in writing, software 20 | # distributed under the License is distributed on an "AS IS" BASIS, 21 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | # See the License for the specific language governing permissions and 23 | # limitations under the License. 24 | # ------------------------------ END-OF-FILE ---------------------------------- 25 | -------------------------------------------------------------------------------- /testbed/docker-phabricator/run-docker-phab-web-mysql.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | set -eux 3 | 4 | # cd to the dir of this script, so paths are relative 5 | cd "$(dirname "$0")" 6 | 7 | docker kill phab-mysql || true 8 | docker kill phab-web || true 9 | docker rm phab-mysql || true 10 | docker rm phab-web || true 11 | 12 | docker run -d --name phab-mysql -e MYSQL_ALLOW_EMPTY_PASSWORD=yes mysql 13 | docker build -t phabricator ../../docker/phabricator 14 | docker run -d -p 80:80 --name phab-web --link phab-mysql phabricator 15 | docker exec phab-web apt-get install mysql-client -y 16 | docker exec phab-web sh -c 'until mysql --host phab-mysql; do sleep 1; done' 17 | docker exec phab-web /phabricator/instances/dev/phabricator/bin/config set mysql.host phab-mysql 18 | docker exec phab-web mkdir -p /opt/ 19 | docker exec phab-web git clone https://github.com/bloomberg/phabricator-tools /opt/phabricator-tools 20 | docker exec phab-web sh -c 'mysql --host phab-mysql < /opt/phabricator-tools/vagrant/puppet/phabricator/files/initial.db' 21 | docker exec phab-web /phabricator/instances/dev/phabricator/bin/storage upgrade -f 22 | 23 | # ----------------------------------------------------------------------------- 24 | # Copyright (C) 2016 Bloomberg Finance L.P. 25 | # 26 | # Licensed under the Apache License, Version 2.0 (the "License"); 27 | # you may not use this file except in compliance with the License. 28 | # You may obtain a copy of the License at 29 | # 30 | # http://www.apache.org/licenses/LICENSE-2.0 31 | # 32 | # Unless required by applicable law or agreed to in writing, software 33 | # distributed under the License is distributed on an "AS IS" BASIS, 34 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 35 | # See the License for the specific language governing permissions and 36 | # limitations under the License. 37 | # ------------------------------ END-OF-FILE ---------------------------------- 38 | -------------------------------------------------------------------------------- /testbed/git-phab-log/smoketest.sh: -------------------------------------------------------------------------------- 1 | trap "echo FAILED!; exit 1" ERR 2 | set -x 3 | 4 | gab='../../proto/git-phab-log' 5 | 6 | $gab -h 7 | # ----------------------------------------------------------------------------- 8 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 9 | # 10 | # Licensed under the Apache License, Version 2.0 (the "License"); 11 | # you may not use this file except in compliance with the License. 12 | # You may obtain a copy of the License at 13 | # 14 | # http://www.apache.org/licenses/LICENSE-2.0 15 | # 16 | # Unless required by applicable law or agreed to in writing, software 17 | # distributed under the License is distributed on an "AS IS" BASIS, 18 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | # See the License for the specific language governing permissions and 20 | # limitations under the License. 21 | # ------------------------------ END-OF-FILE ---------------------------------- 22 | -------------------------------------------------------------------------------- /testbed/install-flake8.sh: -------------------------------------------------------------------------------- 1 | sudo apt-get install python-pip 2 | sudo pip install flake8 3 | # ----------------------------------------------------------------------------- 4 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # ------------------------------ END-OF-FILE ---------------------------------- 18 | -------------------------------------------------------------------------------- /testbed/install-mailcatcher.sh: -------------------------------------------------------------------------------- 1 | sudo apt-get install ruby 2 | sudo apt-get install ruby-dev 3 | sudo apt-get install rubygems 4 | sudo apt-get install rails 5 | sudo apt-get install libsqlite3-dev 6 | sudo gem install mailcatcher 7 | # ----------------------------------------------------------------------------- 8 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 9 | # 10 | # Licensed under the Apache License, Version 2.0 (the "License"); 11 | # you may not use this file except in compliance with the License. 12 | # You may obtain a copy of the License at 13 | # 14 | # http://www.apache.org/licenses/LICENSE-2.0 15 | # 16 | # Unless required by applicable law or agreed to in writing, software 17 | # distributed under the License is distributed on an "AS IS" BASIS, 18 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | # See the License for the specific language governing permissions and 20 | # limitations under the License. 21 | # ------------------------------ END-OF-FILE ---------------------------------- 22 | -------------------------------------------------------------------------------- /testbed/install-nose.sh: -------------------------------------------------------------------------------- 1 | sudo apt-get install python-nose 2 | # ----------------------------------------------------------------------------- 3 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # ------------------------------ END-OF-FILE ---------------------------------- 17 | -------------------------------------------------------------------------------- /testbed/linterate/hello_world.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | cout << "Hello World!"; 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /testbed/linterate/hello_world_bad.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(const int argc, const char* argv[]) 4 | { 5 | cout << "Hello World!"; 6 | int* p = 0; 7 | *p = 0xbad; 8 | 9 | const char *s = argv[0]; 10 | char c = s[0]; 11 | if (0 != s) { 12 | cout << "oops, already crashed."; 13 | } 14 | 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /testbed/linterate/put_hello_world_example.sh: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # put the 'hello_world' files into a new review 3 | ############################################################################### 4 | 5 | set -e 6 | trap "echo FAILED!; exit 1" EXIT 7 | 8 | basedir=$(dirname "$0") # directory the script lives in 9 | arcyon="${basedir}/../../bin/arcyon" 10 | 11 | phaburi="http://127.0.0.1" 12 | aliceuser='alice' 13 | alicecert=35yxukrjcltwgzfmgsnj2klc2jbrnzehqz3c36ijxnicwysv3xenxymwz532pyhimpxh\ 14 | 7jryynh32su2ajxahd3gp7qshyik2qwf6ntuim2acxvjnko6p2q4mhacpvugqou2wpmyqwj4hkchgc\ 15 | 5vh33lur723r4dexy5b3aj35v4v6ffork727ww5qk5yhhcmolbcqg3rxl6qpf53spn4aopneg\ 16 | gtb675hmpx3xya3et7jrowzlkl3yw3sktvdu 17 | 18 | arcyoncreds="--uri ${phaburi} --user ${aliceuser} --cert ${alicecert}" 19 | 20 | git diff -U1000 --no-index -- hello_world.cpp hello_world_bad.cpp | ${arcyon} create-revision -f - -t 'hello world cpp test' -p 'UNTESTED' ${arcyoncreds} 21 | 22 | trap - EXIT 23 | # ----------------------------------------------------------------------------- 24 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 25 | # 26 | # Licensed under the Apache License, Version 2.0 (the "License"); 27 | # you may not use this file except in compliance with the License. 28 | # You may obtain a copy of the License at 29 | # 30 | # http://www.apache.org/licenses/LICENSE-2.0 31 | # 32 | # Unless required by applicable law or agreed to in writing, software 33 | # distributed under the License is distributed on an "AS IS" BASIS, 34 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 35 | # See the License for the specific language governing permissions and 36 | # limitations under the License. 37 | # ------------------------------ END-OF-FILE ---------------------------------- 38 | -------------------------------------------------------------------------------- /testbed/lockfile/.gitignore: -------------------------------------------------------------------------------- 1 | testfile 2 | lockfile 3 | -------------------------------------------------------------------------------- /testbed/lockfile/looping_writer.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | 4 | # append our module dirs to sys.path, which is the list of paths to search 5 | # for modules this is so we can import our libraries directly 6 | # N.B. this magic is only really passable up-front in the entrypoint module 7 | PARENT_DIR = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) 8 | BASE_DIR = os.path.dirname(PARENT_DIR) 9 | sys.path.append(os.path.join(BASE_DIR, "py", "phl")) 10 | 11 | import phlsys_fs 12 | import phlsys_signal 13 | 14 | phlsys_signal.set_exit_on_sigterm() 15 | 16 | while True: 17 | filename = 'testfile' 18 | try: 19 | with phlsys_fs.lockfile_context('lockfile'): 20 | handle = os.open(filename, os.O_CREAT | os.O_EXCL) 21 | os.close(handle) 22 | os.remove(filename) 23 | except phlsys_fs.LockfileExistsError: 24 | pass 25 | 26 | 27 | # ----------------------------------------------------------------------------- 28 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 29 | # 30 | # Licensed under the Apache License, Version 2.0 (the "License"); 31 | # you may not use this file except in compliance with the License. 32 | # You may obtain a copy of the License at 33 | # 34 | # http://www.apache.org/licenses/LICENSE-2.0 35 | # 36 | # Unless required by applicable law or agreed to in writing, software 37 | # distributed under the License is distributed on an "AS IS" BASIS, 38 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 39 | # See the License for the specific language governing permissions and 40 | # limitations under the License. 41 | # ------------------------------ END-OF-FILE ---------------------------------- 42 | -------------------------------------------------------------------------------- /testbed/lockfile/run_loopers.sh: -------------------------------------------------------------------------------- 1 | trap 'kill $(jobs -p)' EXIT 2 | 3 | # remove any remnants from a previous run 4 | rm testfile 5 | rm lockfile 6 | 7 | python looping_writer.py & 8 | python looping_writer.py & 9 | python looping_writer.py & 10 | python looping_writer.py & 11 | 12 | jobs 13 | wait 14 | # ----------------------------------------------------------------------------- 15 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 16 | # 17 | # Licensed under the Apache License, Version 2.0 (the "License"); 18 | # you may not use this file except in compliance with the License. 19 | # You may obtain a copy of the License at 20 | # 21 | # http://www.apache.org/licenses/LICENSE-2.0 22 | # 23 | # Unless required by applicable law or agreed to in writing, software 24 | # distributed under the License is distributed on an "AS IS" BASIS, 25 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 26 | # See the License for the specific language governing permissions and 27 | # limitations under the License. 28 | # ------------------------------ END-OF-FILE ---------------------------------- 29 | -------------------------------------------------------------------------------- /testbed/lockfile/run_singles.sh: -------------------------------------------------------------------------------- 1 | # remove any remnants from a previous run 2 | rm testfile 3 | rm lockfile 4 | 5 | python single_writer.py & 6 | python single_writer.py & 7 | python single_writer.py & 8 | python single_writer.py & 9 | python single_writer.py & 10 | python single_writer.py & 11 | python single_writer.py & 12 | python single_writer.py & 13 | python single_writer.py & 14 | python single_writer.py & 15 | 16 | wait 17 | cat testfile 18 | echo 19 | 20 | # ----------------------------------------------------------------------------- 21 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 22 | # 23 | # Licensed under the Apache License, Version 2.0 (the "License"); 24 | # you may not use this file except in compliance with the License. 25 | # You may obtain a copy of the License at 26 | # 27 | # http://www.apache.org/licenses/LICENSE-2.0 28 | # 29 | # Unless required by applicable law or agreed to in writing, software 30 | # distributed under the License is distributed on an "AS IS" BASIS, 31 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 32 | # See the License for the specific language governing permissions and 33 | # limitations under the License. 34 | # ------------------------------ END-OF-FILE ---------------------------------- 35 | -------------------------------------------------------------------------------- /testbed/lockfile/single_writer.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | 4 | # append our module dirs to sys.path, which is the list of paths to search 5 | # for modules this is so we can import our libraries directly 6 | # N.B. this magic is only really passable up-front in the entrypoint module 7 | PARENT_DIR = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) 8 | BASE_DIR = os.path.dirname(PARENT_DIR) 9 | sys.path.append(os.path.join(BASE_DIR, "py", "phl")) 10 | 11 | import phlsys_fs 12 | import phlsys_signal 13 | 14 | phlsys_signal.set_exit_on_sigterm() 15 | 16 | filename = 'testfile' 17 | count = 0 18 | with phlsys_fs.lockfile_retry_context('lockfile', attempts=3, wait_secs=0.1): 19 | 20 | if os.path.isfile(filename): 21 | with open(filename) as f: 22 | count = int(f.read()) 23 | 24 | count += 1 25 | with open(filename, 'w') as f: 26 | f.write(str(count)) 27 | 28 | 29 | # ----------------------------------------------------------------------------- 30 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 31 | # 32 | # Licensed under the Apache License, Version 2.0 (the "License"); 33 | # you may not use this file except in compliance with the License. 34 | # You may obtain a copy of the License at 35 | # 36 | # http://www.apache.org/licenses/LICENSE-2.0 37 | # 38 | # Unless required by applicable law or agreed to in writing, software 39 | # distributed under the License is distributed on an "AS IS" BASIS, 40 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 41 | # See the License for the specific language governing permissions and 42 | # limitations under the License. 43 | # ------------------------------ END-OF-FILE ---------------------------------- 44 | -------------------------------------------------------------------------------- /testbed/phab-ping/exercise_phabping.sh: -------------------------------------------------------------------------------- 1 | ping="../../bin/phab-ping" 2 | 3 | $ping http://fail.test -c 1 4 | if [ ! "$?" = "1" ]; then 5 | echo FAILED 6 | fi 7 | 8 | trap 'echo FAILED; exit 1' ERR 9 | $ping http://127.0.0.1/api/ -c 1 10 | $ping http://127.0.0.1/api/ -c 0 11 | $ping http://127.0.0.1/api/ -c 1 -i 0.2 12 | 13 | # ----------------------------------------------------------------------------- 14 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 15 | # 16 | # Licensed under the Apache License, Version 2.0 (the "License"); 17 | # you may not use this file except in compliance with the License. 18 | # You may obtain a copy of the License at 19 | # 20 | # http://www.apache.org/licenses/LICENSE-2.0 21 | # 22 | # Unless required by applicable law or agreed to in writing, software 23 | # distributed under the License is distributed on an "AS IS" BASIS, 24 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | # See the License for the specific language governing permissions and 26 | # limitations under the License. 27 | # ------------------------------ END-OF-FILE ---------------------------------- 28 | -------------------------------------------------------------------------------- /testbed/phlsys_fs_atomic/test_file_writer: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | # Test 'file_writer' to see if it will write a partial file occasionally when 3 | # it is 'kill -9'-d. 4 | 5 | truncate -s0 results 6 | for i in {1..1000}; do 7 | rm data 2>/dev/null 8 | ./file_writer data "$@" & 9 | PID=$! 10 | 11 | # Wait for a similar amount of time as our background './file_writer' 12 | # should take before sending it SIGKILL, this way we have a good chance of 13 | # killing it during writing occasionally. 14 | ./file_writer test "$@" 15 | 16 | kill -9 $PID 2>/dev/null 17 | wait $PID 2>/dev/null 18 | rm test 19 | 20 | OUTPUT=$(wc -c data 2>/dev/null) 21 | if [[ -z "${OUTPUT}" ]]; then 22 | # no file 23 | printf '.' 24 | echo '.' >> results 25 | else 26 | if [[ "${OUTPUT}" == "9600 data" ]]; then 27 | # complete file 28 | printf '_' 29 | echo '_' >> results 30 | else 31 | # partial file - this is bad 32 | printf 'X' 33 | echo 'X' >> results 34 | fi 35 | fi 36 | done 37 | echo 38 | rm data 2>/dev/null 39 | rm tmp* 2>/dev/null 40 | sort results | uniq -c 41 | rm results 42 | # ----------------------------------------------------------------------------- 43 | # Copyright (C) 2016 Bloomberg Finance L.P. 44 | # 45 | # Licensed under the Apache License, Version 2.0 (the "License"); 46 | # you may not use this file except in compliance with the License. 47 | # You may obtain a copy of the License at 48 | # 49 | # http://www.apache.org/licenses/LICENSE-2.0 50 | # 51 | # Unless required by applicable law or agreed to in writing, software 52 | # distributed under the License is distributed on an "AS IS" BASIS, 53 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 54 | # See the License for the specific language governing permissions and 55 | # limitations under the License. 56 | # ------------------------------ END-OF-FILE ---------------------------------- 57 | -------------------------------------------------------------------------------- /testbed/phlsys_signal/signal_receiver: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # encoding: utf-8 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | from __future__ import print_function 7 | 8 | import os 9 | import sys 10 | 11 | # The code base currently depends on version 2.7 of Python, any earlier 12 | # than that and it won't have the requisite argparse feaures. Any later 13 | # than that (3.x) and there are breaking changes in the syntax. 14 | # 15 | # Prevent nasty runtime surprises by enforcing version 2.7 as early as 16 | # possible. 17 | # 18 | # The version check itself will not work prior to Python version 2.0, 19 | # that's when sys.version_info was introduced. 20 | # 21 | if sys.version_info[:2] != (2, 7): 22 | sys.stderr.write("You need python 2.7 to run this script\n") 23 | exit(1) 24 | 25 | # append our module dirs to sys.path, which is the list of paths to search 26 | # for modules this is so we can import our libraries directly 27 | # N.B. this magic is only really passable up-front in the entrypoint module 28 | PARENT_DIR = os.path.dirname( 29 | os.path.dirname( 30 | os.path.dirname( 31 | os.path.realpath(__file__)))) 32 | 33 | sys.path.append(os.path.join(PARENT_DIR, "py", "phl")) 34 | 35 | import phlsys_signal 36 | 37 | 38 | def main(): 39 | phlsys_signal.set_exit_on_sigterm() 40 | print('A', end='') 41 | sys.stdout.flush() 42 | with phlsys_signal.no_exit_context(): 43 | print('B', end='') 44 | sys.stdout.flush() 45 | print('C', end='') 46 | sys.stdout.flush() 47 | print('D', end='') 48 | sys.stdout.flush() 49 | print() 50 | 51 | 52 | if __name__ == "__main__": 53 | sys.exit(main()) 54 | 55 | # ----------------------------------------------------------------------------- 56 | # Copyright (C) 2016 Bloomberg Finance L.P. 57 | # 58 | # Licensed under the Apache License, Version 2.0 (the "License"); 59 | # you may not use this file except in compliance with the License. 60 | # You may obtain a copy of the License at 61 | # 62 | # http://www.apache.org/licenses/LICENSE-2.0 63 | # 64 | # Unless required by applicable law or agreed to in writing, software 65 | # distributed under the License is distributed on an "AS IS" BASIS, 66 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 67 | # See the License for the specific language governing permissions and 68 | # limitations under the License. 69 | # ------------------------------ END-OF-FILE ---------------------------------- 70 | -------------------------------------------------------------------------------- /testbed/phlsys_signal/test_signal_receiver: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | # Check that the sequence 'AB' is not observed from the 'signal_receiver' 3 | # program when interrupting it with SIGTERM over many iterations. 4 | truncate -s0 all_signal_stdout 5 | for i in {1..100000}; do 6 | ./signal_receiver > signal_stdout & 7 | PID=$! 8 | 9 | # Wait about the same amount of time as our background process should take 10 | # before killing it, to give us a good chance of interrupting it between 11 | # printing 'B' and 'C'. 12 | ./signal_receiver > /dev/null 13 | 14 | kill $PID 2>/dev/null 15 | wait $PID 2>/dev/null 16 | OUTPUT=$(cat signal_stdout 2>/dev/null) 17 | echo $OUTPUT >> all_signal_stdout 18 | if [[ ! -z "${OUTPUT}" ]]; then 19 | if [[ "${OUTPUT}" != "ABCD" ]]; then 20 | echo $OUTPUT 21 | if [[ "${OUTPUT}" == "AB" ]]; then 22 | echo '!! BAD !!' 23 | exit 1 24 | fi 25 | fi 26 | fi 27 | rm signal_stdout 2>/dev/null 28 | done 29 | sort all_signal_stdout | uniq -c 30 | rm all_signal_stdout 31 | # ----------------------------------------------------------------------------- 32 | # Copyright (C) 2016 Bloomberg Finance L.P. 33 | # 34 | # Licensed under the Apache License, Version 2.0 (the "License"); 35 | # you may not use this file except in compliance with the License. 36 | # You may obtain a copy of the License at 37 | # 38 | # http://www.apache.org/licenses/LICENSE-2.0 39 | # 40 | # Unless required by applicable law or agreed to in writing, software 41 | # distributed under the License is distributed on an "AS IS" BASIS, 42 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 43 | # See the License for the specific language governing permissions and 44 | # limitations under the License. 45 | # ------------------------------ END-OF-FILE ---------------------------------- 46 | -------------------------------------------------------------------------------- /testbed/reader-writer/.gitignore: -------------------------------------------------------------------------------- 1 | test-file 2 | -------------------------------------------------------------------------------- /testbed/reader-writer/reader.py: -------------------------------------------------------------------------------- 1 | import json 2 | import os 3 | import sys 4 | 5 | # append our module dirs to sys.path, which is the list of paths to search 6 | # for modules this is so we can import our libraries directly 7 | # N.B. this magic is only really passable up-front in the entrypoint module 8 | PARENT_DIR = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) 9 | BASE_DIR = os.path.dirname(PARENT_DIR) 10 | sys.path.append(os.path.join(BASE_DIR, "py", "phl")) 11 | 12 | import phlsys_fs 13 | 14 | while True: 15 | with phlsys_fs.read_file_lock_context('test-file') as f: 16 | text = f.read() 17 | 18 | data = {} 19 | if text: 20 | try: 21 | data = json.loads(text) 22 | except Exception as e: 23 | print(e) 24 | print("----") 25 | print(text) 26 | print("----") 27 | raise 28 | 29 | print("read", len(data), "items") 30 | # ----------------------------------------------------------------------------- 31 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 32 | # 33 | # Licensed under the Apache License, Version 2.0 (the "License"); 34 | # you may not use this file except in compliance with the License. 35 | # You may obtain a copy of the License at 36 | # 37 | # http://www.apache.org/licenses/LICENSE-2.0 38 | # 39 | # Unless required by applicable law or agreed to in writing, software 40 | # distributed under the License is distributed on an "AS IS" BASIS, 41 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 42 | # See the License for the specific language governing permissions and 43 | # limitations under the License. 44 | # ------------------------------ END-OF-FILE ---------------------------------- 45 | -------------------------------------------------------------------------------- /testbed/reader-writer/run.sh: -------------------------------------------------------------------------------- 1 | trap 'kill $(jobs -p)' EXIT 2 | 3 | python writer.py & 4 | 5 | for i in {0..10}; do 6 | python reader.py & 7 | done 8 | 9 | jobs 10 | wait 11 | # ----------------------------------------------------------------------------- 12 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 13 | # 14 | # Licensed under the Apache License, Version 2.0 (the "License"); 15 | # you may not use this file except in compliance with the License. 16 | # You may obtain a copy of the License at 17 | # 18 | # http://www.apache.org/licenses/LICENSE-2.0 19 | # 20 | # Unless required by applicable law or agreed to in writing, software 21 | # distributed under the License is distributed on an "AS IS" BASIS, 22 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23 | # See the License for the specific language governing permissions and 24 | # limitations under the License. 25 | # ------------------------------ END-OF-FILE ---------------------------------- 26 | -------------------------------------------------------------------------------- /testbed/reader-writer/writer.py: -------------------------------------------------------------------------------- 1 | import json 2 | import os 3 | import random 4 | import sys 5 | 6 | # append our module dirs to sys.path, which is the list of paths to search 7 | # for modules this is so we can import our libraries directly 8 | # N.B. this magic is only really passable up-front in the entrypoint module 9 | PARENT_DIR = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) 10 | BASE_DIR = os.path.dirname(PARENT_DIR) 11 | sys.path.append(os.path.join(BASE_DIR, "py", "phl")) 12 | 13 | import phlsys_fs 14 | 15 | 16 | while True: 17 | d = {} 18 | for i in xrange(0, random.randint(1, 1000)): 19 | d[i] = random.randint(1, 1000) 20 | 21 | with phlsys_fs.write_file_lock_context('test-file') as f: 22 | f.write(json.dumps(d)) 23 | 24 | # print ".", 25 | # ----------------------------------------------------------------------------- 26 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 27 | # 28 | # Licensed under the Apache License, Version 2.0 (the "License"); 29 | # you may not use this file except in compliance with the License. 30 | # You may obtain a copy of the License at 31 | # 32 | # http://www.apache.org/licenses/LICENSE-2.0 33 | # 34 | # Unless required by applicable law or agreed to in writing, software 35 | # distributed under the License is distributed on an "AS IS" BASIS, 36 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 37 | # See the License for the specific language governing permissions and 38 | # limitations under the License. 39 | # ------------------------------ END-OF-FILE ---------------------------------- 40 | -------------------------------------------------------------------------------- /testbed/singletest.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | if [ $# -ne 3 ] 3 | then 4 | echo usage: singletest.sh MODULE TEST_CLASS TEST_NAME 5 | echo example: singletest.sh abdi_processrepo Test test_A_Breathing 6 | exit 7 | fi 8 | cd "$(git rev-parse --show-toplevel)" 9 | package=`echo $1 | awk '{print substr($0,0,4)}'` 10 | testsuffix="__t.py" 11 | PYTHONPATH=py/phl:testbed/plugins nosetests --nocapture py/$package/$1$testsuffix:$2.$3 12 | # ----------------------------------------------------------------------------- 13 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 14 | # 15 | # Licensed under the Apache License, Version 2.0 (the "License"); 16 | # you may not use this file except in compliance with the License. 17 | # You may obtain a copy of the License at 18 | # 19 | # http://www.apache.org/licenses/LICENSE-2.0 20 | # 21 | # Unless required by applicable law or agreed to in writing, software 22 | # distributed under the License is distributed on an "AS IS" BASIS, 23 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 24 | # See the License for the specific language governing permissions and 25 | # limitations under the License. 26 | # ------------------------------ END-OF-FILE ---------------------------------- 27 | -------------------------------------------------------------------------------- /testbed/threading/thread-subprocess-test.py: -------------------------------------------------------------------------------- 1 | """Test that the 'subprocess' releases the GIL, allowing threading. 2 | 3 | If the GIL was not released for the duration of the calls to 'sleep' then we'd 4 | expect the running time to be over 9 seconds. In practice it's closer to the 5 | ideal of 3 in the single-processor Lubuntu 13.04 VM tested on. 6 | 7 | With this result we can see that there's a benefit to using threading in 8 | conjuction with subprocess, if we're spending a lot of time in subprocess. 9 | 10 | """ 11 | import datetime 12 | import subprocess 13 | import sys 14 | import threading 15 | 16 | 17 | def sleep_work(lock): 18 | with lock: 19 | print("{}: starting sleep".format(threading.current_thread().name)) 20 | subprocess.check_call(["sleep", "3"]) 21 | with lock: 22 | print("{}: finished sleep".format(threading.current_thread().name)) 23 | 24 | 25 | def main(): 26 | start = datetime.datetime.now() 27 | 28 | lock = threading.Lock() 29 | threads = [] 30 | for i in xrange(0, 3): 31 | t = threading.Thread( 32 | args=[lock], 33 | target=sleep_work, 34 | name=str(i)) 35 | threads.append(t) 36 | t.start() 37 | 38 | for t in threads: 39 | t.join() 40 | 41 | end = datetime.datetime.now() 42 | duration = end - start 43 | print("took {} secs".format(duration)) 44 | 45 | 46 | if __name__ == "__main__": 47 | sys.exit(main()) 48 | # ----------------------------------------------------------------------------- 49 | # Copyright (C) 2014 Bloomberg Finance L.P. 50 | # 51 | # Licensed under the Apache License, Version 2.0 (the "License"); 52 | # you may not use this file except in compliance with the License. 53 | # You may obtain a copy of the License at 54 | # 55 | # http://www.apache.org/licenses/LICENSE-2.0 56 | # 57 | # Unless required by applicable law or agreed to in writing, software 58 | # distributed under the License is distributed on an "AS IS" BASIS, 59 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 60 | # See the License for the specific language governing permissions and 61 | # limitations under the License. 62 | # ------------------------------ END-OF-FILE ---------------------------------- 63 | -------------------------------------------------------------------------------- /vagrant/.gitignore: -------------------------------------------------------------------------------- 1 | .vagrant 2 | -------------------------------------------------------------------------------- /vagrant/Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | Vagrant::Config.run do |config| 5 | # All Vagrant configuration is done here. The most common configuration 6 | # options are documented and commented below. For a complete reference, 7 | # please see the online documentation at vagrantup.com. 8 | 9 | # Every Vagrant virtual environment requires a box to build off of. 10 | config.vm.box = "ubuntu/trusty32" 11 | 12 | # Forward a port from the guest to the host, which allows for outside 13 | # computers to access the VM, whereas host only networking does not. 14 | config.vm.forward_port 80, 8080 15 | 16 | config.vm.provision :puppet, :options => ["--debug", "--verbose"] do |puppet| 17 | puppet.manifests_path = "puppet" 18 | puppet.module_path = "puppet" 19 | puppet.manifest_file = "phabricator/manifests/default.pp" 20 | # puppet.options = "--verbose --debug" 21 | end 22 | 23 | # The url from where the 'config.vm.box' box will be fetched if it 24 | # doesn't already exist on the user's system. 25 | # config.vm.box_url = "http://domain.com/path/to/above.box" 26 | 27 | # Boot with a GUI so you can see the screen. (Default is headless) 28 | # config.vm.boot_mode = :gui 29 | 30 | # Assign this VM to a host-only network IP, allowing you to access it 31 | # via the IP. Host-only networks can talk to the host machine as well as 32 | # any other machines on the same network, but cannot be accessed (through this 33 | # network interface) by any external networks. 34 | # config.vm.network :hostonly, "192.168.33.10" 35 | 36 | # Assign this VM to a bridged network, allowing you to connect directly to a 37 | # network using the host's network device. This makes the VM appear as another 38 | # physical device on your network. 39 | # config.vm.network :bridged 40 | 41 | # Share an additional folder to the guest VM. The first argument is 42 | # an identifier, the second is the path on the guest to mount the 43 | # folder, and the third is the path on the host to the actual folder. 44 | # config.vm.share_folder "v-data", "/vagrant_data", "../data" 45 | 46 | end 47 | -------------------------------------------------------------------------------- /vagrant/puppet-apply.sh: -------------------------------------------------------------------------------- 1 | sudo puppet apply puppet/phabricator/manifests/default.pp --modulepath puppet 2 | # ----------------------------------------------------------------------------- 3 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # ------------------------------ END-OF-FILE ---------------------------------- 17 | -------------------------------------------------------------------------------- /vagrant/puppet/phabricator/templates/vhost.erb: -------------------------------------------------------------------------------- 1 | 2 | ServerName localhost 3 | 4 | DocumentRoot <%= @document_root %> 5 | > 6 | Options Indexes FollowSymLinks 7 | AllowOverride None 8 | Require all granted 9 | 10 | 11 | RewriteEngine on 12 | RewriteRule ^/rsrc/(.*) - [L,QSA] 13 | RewriteRule ^/favicon.ico - [L,QSA] 14 | RewriteRule ^(.*)$ /index.php?__path__=$1 [B,L,QSA] 15 | 16 | SetEnv PHABRICATOR_ENV production 17 | 18 | -------------------------------------------------------------------------------- /vagrant/vagrant-windows-msysgit-ssh.sh: -------------------------------------------------------------------------------- 1 | # Vagrant on Windows won't happily ssh in, if you have MSysGit installed then 2 | # you can use this script (an ssh binary seems to come with MSysGit) 3 | ssh vagrant@127.0.0.1 -p 2222 -i $USERPROFILE/.vagrant.d/insecure_private_key 4 | # ----------------------------------------------------------------------------- 5 | # Copyright (C) 2013-2014 Bloomberg Finance L.P. 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | # ------------------------------ END-OF-FILE ---------------------------------- 19 | --------------------------------------------------------------------------------