f1ecf43a83
Summary: Parallel callout to scmquery through conduit This implements the special case of log on a single directory, preserving follow behavior. To do this, we backtrackfrom the current head to find all draft revisions along the path, then find the common public ancestor of those. Once we find that, we can begin paging in results from the scmquery service. Pretty much a working diff at this point. Limits and boundary conditions have not been fully tested. Every once in a while I run into a bum query, which I suspect to be either a bad proxy or a service router failure; still debugging that. Could also be an issue with conduit. Other than that, things seem to work. Test Plan: Testing log with fastest setting (no revsets), revsets (using -M), and with extension disabled (--sparse): [zamsden@devbig192.prn1 ~/local/fbcode] time hg log tao --config extensions.fbconduit=~/local/fb-hgext/hgext3rd/fbconduit.py --config fbconduit.host=our.zamsden.devbig192.prn1.facebook.com --config extensions.fastlog=~/local/fb-hgext/hgext3rd/fastlog.py --pager=off -l 100 -M > a real 0m1.895s user 0m0.003s sys 0m0.004s [zamsden@devbig192.prn1 ~/local/fbcode] time hg log tao --config extensions.fbconduit=~/local/fb-hgext/hgext3rd/fbconduit.py --config fbconduit.host=our.zamsden.devbig192.prn1.facebook.com --config extensions.fastlog=~/local/fb-hgext/hgext3rd/fastlog.py --pager=off -l 100 > b real 0m1.308s user 0m0.005s sys 0m0.001s [zamsden@devbig192.prn1 ~/local/fbcode] diff a b [zamsden@devbig192.prn1 ~/local/fbcode] time hg log tao --config extensions.fbconduit=~/local/fb-hgext/hgext3rd/fbconduit.py --config fbconduit.host=our.zamsden.devbig192.prn1.facebook.com --config extensions.fastlog=~/local/fb-hgext/hgext3rd/fastlog.py --pager=off -l 100 --sparse > c real 0m7.320s user 0m0.004s sys 0m0.003s [zamsden@devbig192.prn1 ~/local/fbcode] diff a c Testing --user option: [zamsden@devbig192.prn1 ~/local/fbsource] time hg log fbcode/dragon --config extensions.fbconduit=~/local/fb-hgext/hgext3rd/fbconduit.py --config fbconduit.host=our.zamsden.devbig192.prn1.facebook.com --config extensions.fastlog=~/local/fb-hgext/hgext3rd/fastlog.py --pager=off -l 5 -u dmitri > a real 0m2.765s user 0m0.002s sys 0m0.004s [zamsden@devbig192.prn1 ~/local/fbsource] time hg log fbcode/dragon --config extensions.fbconduit=~/local/fb-hgext/hgext3rd/fbconduit.py --config fbconduit.host=our.zamsden.devbig192.prn1.facebook.com --config extensions.fastlog=~/local/fb-hgext/hgext3rd/fastlog.py --pager=off -l 5 -u dmitri --sparse > b real 0m23.247s user 0m0.005s sys 0m0.001s [zamsden@devbig192.prn1 ~/local/fbsource] diff a b [zamsden@devbig192.prn1 ~/local/fbsource] Testing same output enabled / disabled for -X option: [zamsden@devbig192.prn1 ~/local/fbsource] time hg log fbcode/lithium/ --config extensions.fbconduit=~/local/fb-hgext/hgext3rd/fbconduit.py --config fbconduit.host=our.zamsden.devbig192.prn1.facebook.com --config extensions.fastlog=~/local/fb-hgext/hgext3rd/fastlog.py --pager=off -l 20 -X '**TARGETS' > a real 0m1.292s user 0m0.002s sys 0m0.003s [zamsden@devbig192.prn1 ~/local/fbsource] time hg log fbcode/lithium/ --config extensions.fbconduit=~/local/fb-hgext/hgext3rd/fbconduit.py --config fbconduit.host=our.zamsden.devbig192.prn1.facebook.com --config extensions.fastlog=~/local/fb-hgext/hgext3rd/fastlog.py --pager=off -l 20 -X '**TARGETS' --sparse > b real 0m2.697s user 0m0.002s sys 0m0.004s [zamsden@devbig192.prn1 ~/local/fbsource] diff a b [zamsden@devbig192.prn1 ~/local/fbsource] Testing -k option: [zamsden@devbig192.prn1 ~/local/fbsource] time hg log fbcode/lithium/ --config extensions.fbconduit=~/local/fb-hgext/hgext3rd/fbconduit.py --config fbconduit.host=our.zamsden.devbig192.prn1.facebook.com --config extensions.fastlog=~/local/fb-hgext/hgext3rd/fastlog.py --pager=off -k 'e' -X '**TARGETS' -l 10 > a real 0m1.174s user 0m0.003s sys 0m0.003s [zamsden@devbig192.prn1 ~/local/fbsource] time hg log fbcode/lithium/ --config extensions.fbconduit=~/local/fb-hgext/hgext3rd/fbconduit.py --config fbconduit.host=our.zamsden.devbig192.prn1.facebook.com --config extensions.fastlog=~/local/fb-hgext/hgext3rd/fastlog.py --pager=off -k 'e' -X '**TARGETS' -l 10 --sparse > b real 0m1.259s user 0m0.004s sys 0m0.002s [zamsden@devbig192.prn1 ~/local/fbsource] diff a b [zamsden@devbig192.prn1 ~/local/fbsource] Testing -I option: [zamsden@devbig192.prn1 ~/local/fbsource] time hg log fbcode/scm/ --config extensions.fbconduit=~/local/fb-hgext/hgext3rd/fbconduit.py --config fbconduit.host=our.zamsden.devbig192.prn1.facebook.com --config extensions.fastlog=~/local/fb-hgext/hgext3rd/fastlog.py --pager=off -l 20 -I '**.py' > a real 0m1.473s user 0m0.005s sys 0m0.003s [zamsden@devbig192.prn1 ~/local/fbsource] time hg log fbcode/scm/ --config extensions.fbconduit=~/local/fb-hgext/hgext3rd/fbconduit.py --config fbconduit.host=our.zamsden.devbig192.prn1.facebook.com --config extensions.fastlog=~/local/fb-hgext/hgext3rd/fastlog.py --pager=off -l 20 -I '**.py' --sparse > b real 0m2.911s user 0m0.003s sys 0m0.002s [zamsden@devbig192.prn1 ~/local/fbsource] diff a b [zamsden@devbig192.prn1 ~/local/fbsource] Testing multiple directory output in all three modes - revset, fast filtered, and forcing original fallback with --sparse [zamsden@devbig192.prn1 ~/local/fbsource] time hg log fbcode/hphp/hhvm fbcode/hphp/runtime/ --config extensions.fbconduit=~/local/fb-hgext/hgext3rd/fbconduit.py --config fbconduit.host=our.zamsden.devbig192.prn1.facebook.com --config extensions.fastlog=~/local/fb-hgext/hgext3rd/fastlog.py --pager=off -l 100 -M > a real 0m2.892s user 0m0.003s sys 0m0.006s [zamsden@devbig192.prn1 ~/local/fbsource] time hg log fbcode/hphp/hhvm fbcode/hphp/runtime/ --config extensions.fbconduit=~/local/fb-hgext/hgext3rd/fbconduit.py --config fbconduit.host=our.zamsden.devbig192.prn1.facebook.com --config extensions.fastlog=~/local/fb-hgext/hgext3rd/fastlog.py --pager=off -l 100 > b real 0m2.575s user 0m0.697s sys 0m0.077s [zamsden@devbig192.prn1 ~/local/fbsource] time hg log fbcode/hphp/hhvm fbcode/hphp/runtime/ --config extensions.fbconduit=~/local/fb-hgext/hgext3rd/fbconduit.py --config fbconduit.host=our.zamsden.devbig192.prn1.facebook.com --config extensions.fastlog=~/local/fb-hgext/hgext3rd/fastlog.py --pager=off -l 100 --sparse > c real 0m7.339s user 0m0.003s sys 0m0.004s [zamsden@devbig192.prn1 ~/local/fbsource] diff a b [zamsden@devbig192.prn1 ~/local/fbsource] diff a c [zamsden@devbig192.prn1 ~/local/fbsource] Reviewers: rmcelroy, #scmquery, #mercurial, ttung, lcharignon, durham, stash Reviewed By: stash Subscribers: cdykes, lcharignon, quark, stash, mjpieters, jeroenv Differential Revision: https://phabricator.intern.facebook.com/D3634075 Tasks: 12341014 Signature: t1:3634075:1471039212:0989839636847a8e5da6a0ef9150035fcf5bb797 |
||
---|---|---|
cfastmanifest | ||
fastmanifest | ||
hgext3rd | ||
linelog | ||
phabricator | ||
scripts | ||
sqldirstate | ||
tests | ||
.editorconfig | ||
.hgignore | ||
cfastmanifest.c | ||
COPYING | ||
Makefile | ||
README.md | ||
setup.py | ||
statprof.py |
hg-experimental
This is a collection of proof-of-concept Mercurial extensions written at Facebook. While they are all in basic use, they are considered experimental, are unsupported, and may or may not receive updates in the future. We're making them open source as examples of some better workflows we've been experimenting with.
Note that there will be extensions included here that only work with Facebook's infrastructure; they are included to give you an idea of how we integrate mercurial with our workflows.
smartlog
An extension that adds the 'hg smartlog' command. It prints graph log output containing only the commits relevant to yourself. Shows your bookmarks, the @ or master bookmark, and any draft commits without bookmarks that you've made within the past 2 weeks. Any commits in the graph that are skipped are represented by '...'.
We recommend also having an 'hg sl' alias that gives more concise output:
alias.sl=smartlog --template "{shortest(node)} {author|user} {bookmarks % '{ifeq(bookmark, current, label(\"yellow\", \" {bookmark}*\"), label(\"green\", \" {bookmark}\"))}'} {ifeq(branch, 'default', '', label(\"bold\", branch))}\n{desc|firstline}\n\n"
githelp
An extension that adds the 'hg githelp' command. It translates Git commands into Mercurial commands. Example:
$ hg githelp -- git rebase origin/master
hg rebase -d master
$ hg githelp -- reset --hard HEAD^
hg strip -r .
So it acts as a useful cheat sheet tool for people moving from Git to Mercurial.
backups
An extension that adds the 'hg backups' command. 'hg backups' prints a list of recently deleted commits (by reading your .hg/strip-backups directory) and allows you to recover a commit by doing 'hg backups --recover '. It prints the missing commits in reverse chronological order, and acts as a pseudo-replacement for Git's reflog.
fbamend
An extension that adds the 'hg amend --rebase' command. When working with a stack of commits, it's currently impossible to amend a commit in the middle of the stack. This extension enables that ability, adds a 'hg amend' command that invokes 'hg commit --amend', and adds a --rebase flag to 'hg amend --rebase' that rebase all the children of the commit onto the newly amended version.
If 'hg amend' is run on a commit in the middle of a stack without using --rebase, the amend succeeds and the old version of the commit is left behind with a marker bookmark on it 'bookmarkname(preamend)'. The user can then run 'hg amend --fixup' to post-humously rebase the children onto the new version of the commit.
chistedit
An interactive ncurses interface to histedit.
NOTE: This requires python-curses installed and Mercurial's histedit extension enabled.
This extensions allows you to interactively move around changesets or change the action to perform while keeping track of possible conflicts.
upgradegeneraldelta
Upgrades manifests to generaldelta in-place, without needing to reclone.
Contributing
Patches are welcome as pull requests, though they will be collapsed and rebased to maintain a linear history.
We (Facebook) have to ask for a "Contributor License Agreement" from someone who sends in a patch or code that we want to include in the codebase. This is a legal requirement; a similar situation applies to Apache and other ASF projects.
If we ask you to fill out a CLA we'll direct you to our online CLA page where you can complete it easily. We use the same form as the Apache CLA so that friction is minimal.
License
These extensions are made available under the terms of the GNU General Public License version 2, or any later version. See the COPYING file that accompanies this distribution for the full text of the license.