Differences between revisions 1 and 60 (spanning 59 versions)
Revision 1 as of 2008-01-14 13:02:04
Size: 7659
Editor: abuehl
Comment: split out from FAQ
Revision 60 as of 2013-08-26 17:49:09
Size: 477
Editor: WillisTra
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
=== What can i configure in Mercurial ===
See in MercurialIni.

=== I get an error while cloning a remote repository via ssh ===

If your remote repository is cloned thusly
{{{
  hg clone ssh://USER@REMOTE/path/to/repo
}}}

And, you find that after successful ssh authentication you get the error message '''remote: abort: repository path/to/repo not found!''' , then you need to know the following:
 * Mercurial's remote repository syntax differs from syntax of other well known programs such as rsync, cvs - both of which use a `:` character to delimit {{{USER@REMOTE}}} from the path component ({{{/path/to/repo}}}).
 * The path to the remote repository is ''relative'' to {{{$HOME}}} of {{{USER}}}. i.e., it is {{{ ~USER/path/to/repo }}}.
 * Remember to use {{{hg -v clone ssh://USER@REMOTE/path/to/repo}}} and observe the remote command being executed via the ssh channel

=== I get an "ssl required" error message when trying to push changes ===

If you're on a network you trust you can add

{{{
[web]
push_ssl = false
}}}

in your <repository-name>/.hg/hgrc file. (Taken from HgWebDirStepByStep)

There's a reason for requiring SSL, however. If you do not trust the network you are using do '''not''' change this.

=== I did an hg pull and my working directory is empty! ===

There are two parts to Mercurial: the repository and the working
directory. {{{hg pull}}} pulls all new changes from a remote repository
into the local one but doesn't alter the working directory.

This keeps you from upsetting your work in progress, which may not be
ready to merge with the new changes you've pulled and also allows you
to manage merging more easily (see below about best practices).

To update your working directory, run {{{hg update}}}. If you're sure you
want to update your working directory on a pull, you can also use
{{{hg pull -u}}}. This will refuse to merge or overwrite local changes.

=== I want to retrieve an old version of my project, what do I do? ===

You want {{{hg update -C <version>}}}, which will clobber your current version with the requested version.

You '''don't''' want {{{hg revert <version>}}}, which reverts changes in your working directory back to that version, but '''keeps''' the current parents for the next checkin. This command exists for undoing changes in current versions, not for working on old versions.

=== hg status shows changed files but hg diff doesn't! ===

{{{hg status}}} reports when file '''contents''' or '''flags''' have changed relative to '''either''' parent. {{{hg diff}}} only reports changed '''contents''' relative to the first parent. You can see flag information with the {{{--git}}} option to {{{hg diff}}} and deltas relative to the other parent with {{{-r}}}.

=== hg export or log -p shows a strange diff for my merge! ===

The diff shown by {{{hg export}}} and {{{hg log}}} is always against the first parent for consistency. Also, the files listed are only the files that have changed relative to ''both'' parents.

=== I did an hg revert and my working directory still has changes in it! ===

You've probably done an {{{hg merge}}}, which means your working directory now has two parents according to {{{hg parents}}}. A subsequent {{{hg revert}}} will revert your working directory ''back to the primary parent'', thus leaving you with the differences between the two parents. {{{hg update -C}}} will revert the left files.

If you're trying to switch between revisions in history, you probably want
{{{hg update -C}}}.

=== I want a clean, empty working directory ===

The easiest thing to do is run {{{hg clone -U}}} which will create a fresh clone
without checking out a working copy.

'''Note''': you might want to copy hgrc file from your old repository.

=== I committed a change containing nuclear launch codes, how do I delete it permanently? ===

If you've just committed it, and you haven't done any other commits or pulls since, you may be able to use {{{rollback}}} to undo the last commit transaction:

{{{
$ hg rollback
rolling back last transaction
}}}

If you've made other changes but you haven't yet published it to the world, you can do something like the following:

{{{
$ hg clone -r <untainted-revision> tainted-repo untainted-repo
}}}

The strip command in the mq extension may also be useful here for doing operations in place.

This will get you a new repo without the tainted change or the ones that follow it. You can import the further changes with {{{hg export}}} and {{{hg import}}} or by using the TransplantExtension. See TrimmingHistory for possible future approaches.

If you've already pushed your changes to a public repository that people have cloned from, the genie is out of the bottle. Good luck cleaning up your mess.

''“Judge Tries to Unring Bell Hanging Around Neck of Horse Already Out of Barn Being Carried on Ship That Has Sailed.” - William G. Childs''

=== I tried to check in an empty directory and it failed! ===

Mercurial doesn't track directories, it only tracks files. Which works for just about everything, except directories with no files in them. As empty directories aren't terribly useful and it makes the system much simpler, we don't intend to fix this any time soon. A couple workarounds:

 * add a file, like "this-dir-intentionally-left-blank"
 * create the directory with your Makefiles or other build processes

=== I want to get an email when a commit happens! ===

See CommitHook for an example.

=== I'd like to put only some few files of a large directory tree (home dir for instance) under mercurial's control, and it is taking forever to diff or commit ===

Just do a {{{
printf "syntax: glob\n*\n" > .hgignore
}}}
or, if you are using 0.7 or below, {{{
printf ".*\n" > .hgignore
}}}

This will make hg ignore all files except those explicitly added.

=== Why is the modification time of files not restored on checkout? ===

If you use automatic build tools like make or distutils, some built files
might not be updated if you checkout an older revision of a file.
Additionally a newer changeset might have an older commit timestamp due to
pulling from someone else or importing patches somebody has done some time
ago, so checking out a ''newer'' changeset would have to make the files
''older'' in this case.

If you need predictable timestamps you can use ''hg archive'', which can do
something like a checkout in a separate directory. Because this directory is
newly created, there is nothing like switching to a different changeset
afterwards, therefore the above mentioned problems don't apply here.

=== My merge program failed, and now I don't know what to do ===

If your merge program fails you'll find yourself in a state where both hg up
and hg merge produce the same, unhelpful output.

{{{
abort: outstanding uncommitted merges
}}}

When this first happened, mercurial told you what to do, but if you've lost
those instructions, how does one recover them?

Why does hg merge not invoke merge again? Why the unhelpful output?

=== Any way to 'hg push' and have an automatic 'hg update' on the remote server? ===
{{{
[hooks]
changegroup = hg update >&2
}}}

This goes in .hg/hgrc on the remote repository.
Output has to be redirected to stderr (or /dev/null), because stdout is used
for the data stream.

=== How can store my HTTP login once and for all ? ===

You can specify the usename and password in the URL like:

{{{
http://user:password@mydomain.org
}}}

Then add a new entry in the ''paths'' section of your hgrc file.
Hi there. Allow me commence by introducing the creator, his [[http://Www.bluesheet.com.au/Identify/|identify]] is Jan although it is not his delivery title. To read comics is one thing he definitely enjoys doing. Bookkeeping has been his career for some time but he's previously utilized for one more a single. Arizona is the position he enjoys most and he does not program on changing it. If you want to obtain uot a lot more test out his web page: http://eztraderreview.org

Hi there. Allow me commence by introducing the creator, his identify is Jan although it is not his delivery title. To read comics is one thing he definitely enjoys doing. Bookkeeping has been his career for some time but he's previously utilized for one more a single. Arizona is the position he enjoys most and he does not program on changing it. If you want to obtain uot a lot more test out his web page: http://eztraderreview.org

FAQ/CommonProblems (last edited 2018-02-22 02:01:15 by JohnHein)