When doing Mercurial work at the U:
Backs out all modifications to the last commit.
This will undo the last transaction such as a commit, pull, etc.
Undo effect of a commit by adding to the repository the inverse of the last commit.
This is a Mercurial extension that allows you to do surgery on a repo.
When updating the entire .hg
folder from the Windows servers onto my local machine, SourceTree or Mercurial will show that there are thousands of modified files, but diff
shows that they are identical. This is because some tracked flag is different.
The fix is easy, just Revert all the local changes. In SourceTree, this is done by highlighting your current branch and then clicking the big “Revert” button on the toolbar.
You may then have to apply standard Drupal security permissions.
There are several ways to branch in Mercurial, but common consensus seems to recommend "Named Branches". I believe this is the method that happens when clicking the "Branch" button inside SourceTree. Creating a branch will label the Working Copy, but it is not actually created until you do the first commit. (Hence people creating commits called "stupid commit", etc.)
Once you are done with a branch, you probably should close it. There are a few methods:
hg commit --close-branch
I'm not exactly sure, but I think this just means do not list in active branches command (hg branches
)
The recommended procedure to really eliminate unwanted heads is to use hg clone --rev. First, you rename your current repo to a backup. Then you clone the backup back to the original name, but you specify --rev X where X is the parent of the first of the chain of wanted changesets. If your repository has other heads you need to preserve, specify them too, as additional --rev Y arguments. For example:
hg clone backup repo --rev X --rev Y
When you've cloned, verify that
hg incoming -R repo backup
really only shows the changesets you wanted to drop. If you discover changesets you do need, after all (for instance, another head you forgot to specify above), you can pull them over using
hg pull -R repo backup --rev Y
Repeat until you're satisfied with the pruned repo.
Copy over all non-tracked files you might want to preserve. In particular, you might want to copy .hg/hgrc from the backup since your default path now points to the backup instead of the original clone source.
You can remove your backup repository now.
There’s one more big difference between Mercurial’s branching and git’s branching:
Mercurial will push/pull all branches by default, while git will push/pull only the current branch.
This is important if you’re a git user working with Mercurial. If you want to push/pull only a single branch with Mercurial you can use the --rev option (-r for short) and specify the tip revision of the branch:
$ hg push --rev branchname $ hg push --rev bookmarkname $ hg push --rev 4
If you specify a revision, Mercurial will push that changeset and any ancestors of it that the target doesn’t already have.