I want to know if there's a way to turn off the default push, but keep the default pull when using Mercurial. I don't want to accidentally pollute the master repository by inadvertently pushing from an experimental repository.
相关问题
- Mercurial compared to private branches in SVN
- Warn user if Google Services' Restrict backgro
- Using Subversion and SourceSafe at the same time?
- How to abandon all Mercurial changes that haven
- subversion merge - “has different repository root
相关文章
- Mercurial Commit Charts / Graphs [closed]
- What is the tortoisehg gui equivalent of doing “hg
- How to use Mercurial from Visual Studio 2010?
- SSIS solution on GIT?
- Is it possible to do a “destroy history” in TFS?
- Is there a version control system abstraction for
- Get Android library module version number from ins
- Sprockets::CircularDependencyError application.js
I like your own answer of setting
paths.default-push = .
-- it is simple and it is clear that it will work.Another option would be a pre-push hook:
(Here I'm taking advantage of how you can split a long value over several lines by indenting them in a Mercurial config file.)
A push to default looks this
where I typed the
n
. The hooks checks for both no arguments ($HG_PATS == "[]"
) and a default as the argument ($HG_PATS == "['default']"
) and will only prompt you in those cases. The$HG_PATS
variable was introduced in Mercurial 1.6.PS: I saw you updated the question and asked for a solution in PowerShell, but I'm afraid I know nothing about that language. However, you should be able to lift the important concepts from this answer yourself.
The answer previously posted, in hgrc setting
is ALMOST but not quite correct. It can break, e.g. if you hg your home directory.
Here is the my current BKM to disable default-push:
I've embellished the idea of setting paths.default-push in ~/.hgrc, making it a little bit more self documenting and less error-prone - since, as I point out below, setting default-push = . does not always disable pushing.
in ~/.hgrc
I was able to solve this by putting the following in my
.hg/hgrc
file, but I was wondering if there's a better/official way.Your solution probably is the quickest and is certainly effective. If there's any official way it would be using a
preoutgoing
hook:which will ask you if you want to push and provide the URL to which it would go as a reminder.