3c80b1176b
Summary: Recently @rmcelroy discovered that attempting to rebase a single commit in the middle of a stack results in the rest of the stack being marked as unstable. See https://fb.facebook.com/groups/sourcecontrol/permalink/1207767375939547/ for full example. It turns out that the inhibit extension's post-transaction hook that would ordinarily inhibit the rebased (and thus obsolete) commit, and thereby hide the instability, was not firing in this case. This was similar to a previous problem with `hg next --rebase` wherein `--continue`'ing a rebase with conflicts would result in visible instability for the same reason. In both cases, the problem appears to be that `rebase` doesn't actually create a transaction, so of course the post-transaction hook doesn't fire. The solution for `hg next --rebase` was to add a (nearly) empty transaction after the rebase call to trigger the hook. This diff just makes this the default behavior for `hg rebase` so that the hook is always called. Test Plan: See new test file. Basically, create a situation like: ``` o e5d56d debugbuilddag | r3 | | o c175ba debugbuilddag | | r2 | | | o 220949 debugbuilddag |/ r1 | o 1ad88b debugbuilddag r0 ``` Perform `hg rebase -r 1 -d 3`, which rebases commit "r1" onto "r3", which would ordinarily make "r2" unstable. Instead, the result should be as below, with no visible instability because "r1" is inhibited. ``` o 738e8e debugbuilddag | r1 | o e5d56d debugbuilddag | r3 | | o c175ba debugbuilddag | | r2 | | | x 220949 (Rebased as 738e8e) debugbuilddag |/ r1 | o 1ad88b debugbuilddag r0 ``` Reviewers: rmcelroy, #mercurial, durham Reviewed By: durham Subscribers: mjpieters, rmcelroy Differential Revision: https://phabricator.intern.facebook.com/D4491870 Tasks: 15697758 Signature: t1:4491870:1486033128:45b8e9a72af1e88ab78484ddef47a788d1aca7b5 |
||
---|---|---|
cdatapack | ||
cfastmanifest | ||
clib | ||
contrib | ||
ctreemanifest | ||
fastannotate | ||
fastmanifest | ||
hgext3rd | ||
infinitepush | ||
linelog | ||
phabricator | ||
remotefilelog | ||
scripts | ||
sqldirstate | ||
tests | ||
treemanifest | ||
.editorconfig | ||
.hgignore | ||
cfastmanifest.c | ||
CMakeLists.txt | ||
COPYING | ||
Makefile | ||
README.md | ||
setup.py | ||
statprof.py |
fb-hgext
This is a collection of Mercurial extensions written at Facebook. Many of them are in heavy use by thousands of users on a daily basis. However, some of them are very specific to Facebook's very large repositories so their value to others will vary. We're still making these open source as examples of the workflows we use and direction we are working.
Note that there will be extensions included here that only work with Facebook's internal infrastructure; they are included to give you an idea of how we integrate mercurial with our workflows.
Below are snippets about some of the extensions contained here.
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.
uncommit
Adds a 'hg uncommit' command, which undoes the effect of a local commit. This allows you to either undo a mistake, or remove files from a commit which weren't intended for it.
By default it uncommits all the files, and completely hides the changeset. However, if filenames are specified then it will create a new changeset excluding those files and leave the files in a dirty state in the working dir. In all cases, files are left unchanged in the working dir, so other local changes are unaffected.
Uncommit does work in the middle of a stack of changes (possibly creating a new head), but cannot be used to undo a merge changeset.
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.