⇤ ← Revision 1 as of 2008-11-08 13:57:28
Size: 5118
Comment:
|
Size: 13322
Comment: add some sections
|
Deletions are marked like this. | Additions are marked like this. |
Line 3: | Line 3: |
=== 自分がチェックアウトしたリビジョンが分からなくなりました === [:Parent:parent] コマンドを使いましょう([:TutorialClone] で使用例を見れます)。 === Mercurialで設定を変えられるのはどこですか? === MercurialIni を見てください。 === ssh経由でリモートリポジトリをcloneしようとしたらエラーが出ます === もし、こんな風にしてリモートリポジトリをcloneしたとして、 {{{ hg clone ssh://USER@REMOTE/path/to/repo }}} そして、sshの認証に成功した後で'''remote: abort: There is no Mercurial repository here (.hg not found)!'''というエラーメッセージが出てきたのなら、あなたは次の項目を知っておくべきでしょう。 * Mercurialのリモート [:Repository:リポジトリ] 指定文法は、rsync, cvsといった他のよく知られたプログラムとは異なります。それらはどちらとも、 {{{USER@REMOTE}}} とパス指定部分との区切りに`:`文字を使います。 * リモートリポジトリのパスは {{{USER}}} の {{{$HOME}}} からの''相対''パスとして扱われます。即ち、上の例では {{{ ~USER/path/to/repo }}} です。 訳注: もし絶対パスで指定するのを意図していたのなら、この例は {{{ hg clone ssh://USER@REMOTE//path/to/repo }}} となります。 * {{{hg -v clone ssh://USER@REMOTE/path/to/repo}}} を使って、sshチャネル経由で実行されるリモート側のコマンドを監視する事も忘れないでください。 一方、もしエラーメッセージが'''remote: bash: line 1: hg: command not found'''なら、問題はsshによって使用される環境で`PATH`に`hg`コマンドが無い事です。この問題に対処するには次の2つの方法があります。 * `~/.hgrc`の`[ui]`セクションで、`remotecmd`に`hg`コマンドへの正確なパスを設定します。 * サーバ上で、適切な`PATH`を定義する`~/.ssh/environment`ファイルを作成し、`/etc/sshd_config`に`PermitUserEnvironment yes`を加えます。 === 変更をpushしようとしたら、"ssl required"というエラーメッセージが出ます === ネットワーク経路が信頼出来る場合は、次の内容を<リポジトリ名>/.hg/hgrcに加えて解決出来ます。 {{{ [web] push_ssl = false }}} しかしながら、SSLが必要とされるのはそれなりの理由があります。使用しているネットワーク経路が信頼出来ないのなら、この変更を'''行わないで'''ください。 |
|
Line 19: | Line 55: |
=== hg status shows changed files but hg diff doesn't! === {{{hg status}}} reports when file '''contents''' or '''flags''' have changed relative to '''either''' [:Parent: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:diff] shown by {{{hg diff}}}, {{{hg export}}} and {{{hg log}}} is always against the first [:Parent:parent] for consistency. Also, the files listed are only the files that have changed relative to ''both'' parents. (Are diffs of merges really always against the first parent? Doesn't {{{hg export}}} have a --switch-parent option? It would also be good if the docs would give the rational for {{{hg diff}}} and {{{hg log}}} not having that option (assuming they don't--the man page only mentions it for export).) |
|
Line 30: | Line 76: |
=== I committed a change containing nuclear launch codes, how do I delete it permanently? === If you've just [:Commit:committed] it, and you haven't done any other commits or [:Pull:pulls] since, you may be able to use {{{rollback}}} (see ["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 [:MqExtension: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:repository] that people have [:Clone: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'' For more details, see EditingHistory. |
|
Line 59: | Line 130: |
=== 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:repository]. Output has to be redirected to stderr (or /dev/null), because stdout is used for the data stream. === How can I 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. === How can I do a "hg log" of a remote repository? === You can't. Mercurial accepts only local [:Repository:repositories] for the -R option (see {{{hg help -v log}}}). {{{ > hg log -R http://www.selenic.com/repo/hello abort: repository 'http://www.selenic.com/repo/hello' is not local }}} The correct way to do this is [:Clone:cloning] the remote repository to your computer and then doing a {{{hg log}}} locally. This is a very deliberate explicit design decision made by project leader Matt Mackall (mpm). See also http://www.selenic.com/mercurial/bts/issue1025 for the reasoning behind that. === How can I find out if there are new changesets in a remote repository? === To get the [:ChangeSetID:changeset id] of the [:Tip:tipmost] [:ChangeSet:changeset] of a remote [:Repository:repository] you can do: {{{ > hg id -i -r tip http://www.selenic.com/repo/hello 82e55d328c8c }}} When it changes, you have new changesets in the remote repository. === What can I do with a head I don't want anymore? === See [:PruningDeadBranches] === The clone command is returning the wrong version in my workspace! === [:Clone] checks out the tip of the default (aka unnamed) branch (see NamedBranches). Ergo, you probably want to keep your main branch unnamed. === Any way to track ownership and permissions? === If you're using Mercurial for config file management, you might want to track file properties (ownership and permissions) too. Mercurial only tracks the executable bit of each file. Here is an example of how to save the properties along with the files (works on Linux if you've the ''acl'' package installed): {{{ # cd /etc && getfacl -R . >/tmp/acl.$$ && mv /tmp/acl.$$ .acl # hg commit }}} This is far from perfect, but you get the idea. For a more sophisticated solution, check out ''etckeeper''. === I get a "no space left" or "disk quota exceeded" on push === I get a "no space left" or "disk quota exceeded" on push, but there is plenty of space or/and I have no quota limit on the device where the remote hg repository is. The problem comes probably from the fact that mercurial uses {{{/tmp}}} (or one of the directory define by environment variables {{{$TMPDIR, $TEMP}}} or {{{$TMP}}}) to uncompress the bundle received on the wire. The decompression may then reach device limits. You can of course set {{{$TMPDIR}}} to another location on remote in the default shell configuration file, but it will be potentially used by other processes than mercurial. Another solution is to set a hook in a global [:hgrc:.hgrc] on remote. See the description of how to set a [:Hook#tmpdirhook:hook for changing tmp directory] on remote when pushing. |
自分がチェックアウトしたリビジョンが分からなくなりました
[:Parent:parent] コマンドを使いましょう([:TutorialClone] で使用例を見れます)。
Mercurialで設定を変えられるのはどこですか?
MercurialIni を見てください。
ssh経由でリモートリポジトリをcloneしようとしたらエラーが出ます
もし、こんな風にしてリモートリポジトリをcloneしたとして、
hg clone ssh://USER@REMOTE/path/to/repo
そして、sshの認証に成功した後でremote: abort: There is no Mercurial repository here (.hg not found)!というエラーメッセージが出てきたのなら、あなたは次の項目を知っておくべきでしょう。
Mercurialのリモート [:Repository:リポジトリ] 指定文法は、rsync, cvsといった他のよく知られたプログラムとは異なります。それらはどちらとも、 USER@REMOTE とパス指定部分との区切りに:文字を使います。
リモートリポジトリのパスは USER の $HOME からの相対パスとして扱われます。即ち、上の例では ~USER/path/to/repo です。
訳注: もし絶対パスで指定するのを意図していたのなら、この例は hg clone ssh://USER@REMOTE//path/to/repo となります。
hg -v clone ssh://USER@REMOTE/path/to/repo を使って、sshチャネル経由で実行されるリモート側のコマンドを監視する事も忘れないでください。
一方、もしエラーメッセージがremote: bash: line 1: hg: command not foundなら、問題はsshによって使用される環境でPATHにhgコマンドが無い事です。この問題に対処するには次の2つの方法があります。
~/.hgrcの[ui]セクションで、remotecmdにhgコマンドへの正確なパスを設定します。
サーバ上で、適切なPATHを定義する~/.ssh/environmentファイルを作成し、/etc/sshd_configにPermitUserEnvironment yesを加えます。
変更をpushしようとしたら、"ssl required"というエラーメッセージが出ます
ネットワーク経路が信頼出来る場合は、次の内容を<リポジトリ名>/.hg/hgrcに加えて解決出来ます。
[web] push_ssl = false
しかしながら、SSLが必要とされるのはそれなりの理由があります。使用しているネットワーク経路が信頼出来ないのなら、この変更を行わないでください。
hg pullとしたのにワーキングディレクトリはからっぽのままです
Mercurialというシステムにはリポジトリとワーキングディレクトリの2つの概念があります。hg pull はリモートリポジトリでの変更をローカルリポジトリに引っ張ってきますがワーキングディレクトリは変更しません。
そのおかげで引っ張ってきた変更をまだマージできずに作業中の状態がめちゃくちゃになるのを防げます。マージもやりやすくなります。
ワーキングディレクトリを更新するには、hg updateを実行してください。pullをするときにワーキングディレクトリも更新したい場合はhg pull -uとします。こうした場合はローカルでの変更をマージしたり上書きしたりはしません。
古いバージョンに戻したいのですが、どうすればよいですか?
hg update -C <version>で最新版が上書きされ指定したバージョンに移動します。
hg revert <version>とするとワーキングディレクトの内容は指定したバージョンにまで戻ってしまいますが、次のコミットでのparentは変化しません。revertは現在のバージョンの変更をなかったことにするために使うもので、古いバージョン上で作業するためには使えません。
(訳注:hg update -Cではワーキングディレクトリの内容とparentの両方が変化しますが、hg revert <version>ではワーキングディレクトリの内容は変わりますがparentはもとのままです)
hg status shows changed files but hg diff doesn't!
hg status reports when file contents or flags have changed relative to either [:Parent: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:diff] shown by hg diff, hg export and hg log is always against the first [:Parent:parent] for consistency. Also, the files listed are only the files that have changed relative to both parents.
(Are diffs of merges really always against the first parent? Doesn't hg export have a --switch-parent option? It would also be good if the docs would give the rational for hg diff and hg log not having that option (assuming they don't--the man page only mentions it for export).)
revertでワーキングディレクトリを戻したのですが完全には戻りません
多分hg update -mをしたのでしょう。つまりhg parentsで見られるparentが2つになっていませんか。hg revertではワーキングディレクトリをprimary parentに戻すので、2つの親の間で異なる部分は戻されません。で完全に戻ります。
リビジョン間を移動したい場合はきっとが有用でしょう。
からっぽのきれいなワーキングディレクトリが欲しい
一番簡単な方法はhg clone -Uを使うことです。こうすると新しい複製を作りますがワーキングディレクトリ上には何も置かれません。
注: hgrcをもとのリポジトリからコピーしたほうが良いかもしれません。
I committed a change containing nuclear launch codes, how do I delete it permanently?
If you've just [:Commit:committed] it, and you haven't done any other commits or [:Pull:pulls] since, you may be able to use rollback (see ["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 [:MqExtension: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:repository] that people have [:Clone: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
For more details, see EditingHistory.
からっぽのディレクトリをaddしようとしたがうまくいきません
Mercurialではディレクトリの履歴を管理しません。ファイルのみ管理します。普通は問題ないのですが、ファイルを1つも持たないディレクトリは取り扱えません。からっぽのディレクトリはそう便利というものでもなく、実装が複雑になりかねないのですぐに修正するつもりはありません。以下のような解決策を用いてください:
- "this-dir-intentionally-left-blank" のようなファイルを追加する
- Makefileなどのビルドプロセスでディレクトリを生成する
コミットしたときにメールを出したい
CommitHook を見てください。
多くのファイルのあるディレクトリのなかで少数のファイルだけをMercurialの管理下に置きたい(例えば ~/ )が、diffやcommitに時間がかかる
printf "syntax: glob\n*\n" > .hgignore
とするか、もしくは 0.7 以降であれば
printf ".*\n" > .hgignore
としてもかまいません。
こうするとhgコマンドは明示的にファイルを追加しない限りすべてのファイルを無視します。
何故ファイルのmtimeがチェックアウト時に元に(訳注:コミット時のものに?)戻さないの?
makeやdistutilsのようなビルドツールを使う場合、古いリビジョンにupdateするとそれらのツールによるファイルの更新がうまくいかないかもしれないという問題があるからです。さらに新しいほうのチェンジセットのほうがタイムスタンプが古い可能性もあります、というのは他のリポジトリからのpullや人からのパッチをimportした場合、リポジトリから取り出した 新しいチェンジセットのせいでタイムスタンプが 古く なってしまうかもしれないからです。
(訳注:以下の訳はかなり怪しい) hg archiveを使うと、別のディレクトリにチェックアウトするようなことができます。これでタイムスタンプを制御できます。このディレクトリは新しく作られるので、後から別のチェンジセットに切り替えられたりすることがなく、上で挙げたような問題は生じません。
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:repository]. Output has to be redirected to stderr (or /dev/null), because stdout is used for the data stream.
How can I 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.
How can I do a "hg log" of a remote repository?
You can't. Mercurial accepts only local [:Repository:repositories] for the -R option (see hg help -v log).
> hg log -R http://www.selenic.com/repo/hello abort: repository 'http://www.selenic.com/repo/hello' is not local
The correct way to do this is [:Clone:cloning] the remote repository to your computer and then doing a hg log locally.
This is a very deliberate explicit design decision made by project leader Matt Mackall (mpm). See also http://www.selenic.com/mercurial/bts/issue1025 for the reasoning behind that.
How can I find out if there are new changesets in a remote repository?
To get the [:ChangeSetID:changeset id] of the [:Tip:tipmost] [:ChangeSet:changeset] of a remote [:Repository:repository] you can do:
> hg id -i -r tip http://www.selenic.com/repo/hello 82e55d328c8c
When it changes, you have new changesets in the remote repository.
What can I do with a head I don't want anymore?
See [:PruningDeadBranches]
The clone command is returning the wrong version in my workspace!
[:Clone] checks out the tip of the default (aka unnamed) branch (see NamedBranches). Ergo, you probably want to keep your main branch unnamed.
Any way to track ownership and permissions?
If you're using Mercurial for config file management, you might want to track file properties (ownership and permissions) too. Mercurial only tracks the executable bit of each file.
Here is an example of how to save the properties along with the files (works on Linux if you've the acl package installed):
# cd /etc && getfacl -R . >/tmp/acl.$$ && mv /tmp/acl.$$ .acl # hg commit
This is far from perfect, but you get the idea. For a more sophisticated solution, check out etckeeper.
I get a "no space left" or "disk quota exceeded" on push
I get a "no space left" or "disk quota exceeded" on push, but there is plenty of space or/and I have no quota limit on the device where the remote hg repository is.
The problem comes probably from the fact that mercurial uses /tmp (or one of the directory define by environment variables $TMPDIR, $TEMP or $TMP) to uncompress the bundle received on the wire. The decompression may then reach device limits.
You can of course set $TMPDIR to another location on remote in the default shell configuration file, but it will be potentially used by other processes than mercurial. Another solution is to set a hook in a global [:hgrc:.hgrc] on remote. See the description of how to set a [:Hook#tmpdirhook:hook for changing tmp directory] on remote when pushing.