差分
このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン 次のリビジョン両方とも次のリビジョン | ||
python:mercurial [2019/01/29 07:23] – [リモートリポジトリへ変更反映] ともやん | python:mercurial [2024/03/14 09:06] – [リモートリポジトリの複製] ともやん | ||
---|---|---|---|
行 1: | 行 1: | ||
- | ====== Mercurial - 分散バージョン管理システム ====== | + | ====== Mercurial - 分散型バージョン管理システム ====== |
+ | 本家: [[https:// | ||
+ | |||
+ | 関連: [[linux: | ||
===== 前提条件 ===== | ===== 前提条件 ===== | ||
行 7: | 行 10: | ||
[[python: | [[python: | ||
- | CentOS | + | Fedora |
- | <code> | + | <WRAP color_term> |
- | $ sudo yum install gcc python-devel | + | <WRAP color_command>< |
- | </code> | + | <font color="# |
+ | </pre></ | ||
+ | </ | ||
===== インストール ===== | ===== インストール ===== | ||
- | <code> | + | **pip** によるインストール。\\ |
- | $ sudo pip install mercurial | + | <WRAP color_term> |
- | </code> | + | <WRAP color_command>< |
+ | <font color="# | ||
+ | </ | ||
+ | <WRAP color_result>< | ||
+ | Collecting mercurial | ||
+ | Downloading mercurial-6.6.3.tar.gz (8.3 MB) | ||
+ | < | ||
+ | Installing build dependencies ... done | ||
+ | Getting requirements to build wheel ... done | ||
+ | Preparing metadata (pyproject.toml) ... done | ||
+ | Building wheels for collected packages: mercurial | ||
+ | Building wheel for mercurial (pyproject.toml) ... done | ||
+ | Created wheel for mercurial: filename=mercurial-6.6.3-cp312-cp312-linux_x86_64.whl size=4743353 sha256=a592c0a7feb366d2f05ce876e9ca095602dee4e3944359c46678136601ca6cd3 | ||
+ | Stored in directory: / | ||
+ | Successfully built mercurial | ||
+ | Installing collected packages: mercurial | ||
+ | Successfully installed mercurial-6.6.3 | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | **DietPi**\\ | ||
+ | <WRAP color_term> | ||
+ | <WRAP color_command>< | ||
+ | <font color="# | ||
+ | </ | ||
+ | <WRAP color_result>< | ||
+ | Looking in indexes: https:// | ||
+ | Collecting mercurial | ||
+ | Downloading https:// | ||
+ | < | ||
+ | Installing collected packages: mercurial | ||
+ | Successfully installed mercurial-6.6.3 | ||
+ | </ | ||
+ | <WRAP color_command>< | ||
+ | <font color="# | ||
+ | </ | ||
+ | <WRAP color_result>< | ||
+ | / | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | **dnf** によるインストール。\\ | ||
+ | <WRAP color_term> | ||
+ | <WRAP color_command>< | ||
+ | <font color="# | ||
+ | </ | ||
+ | <WRAP color_result_long>< | ||
+ | メタデータの期限切れの最終確認: | ||
+ | 依存関係が解決しました。 | ||
+ | ============================================================================================================== | ||
+ | | ||
+ | ============================================================================================================== | ||
+ | インストール: | ||
+ | < | ||
+ | 依存関係のインストール: | ||
+ | < | ||
+ | |||
+ | トランザクションの概要 | ||
+ | ============================================================================================================== | ||
+ | インストール | ||
+ | |||
+ | ダウンロードサイズの合計: | ||
+ | インストール後のサイズ: | ||
+ | パッケージのダウンロード: | ||
+ | (1/2): python3-zombie-imp-0.0.2-2.fc39.noarch.rpm | ||
+ | (2/2): mercurial-6.5.3-1.fc39.x86_64.rpm | ||
+ | -------------------------------------------------------------------------------------------------------------- | ||
+ | 合計 | ||
+ | トランザクションの確認を実行中 | ||
+ | トランザクションの確認に成功しました。 | ||
+ | トランザクションのテストを実行中 | ||
+ | トランザクションのテストに成功しました。 | ||
+ | トランザクションを実行中 | ||
+ | 準備 | ||
+ | インストール中 | ||
+ | インストール中 | ||
+ | scriptletの実行中: | ||
+ | 検証 | ||
+ | 検証 | ||
+ | |||
+ | インストール済み: | ||
+ | mercurial-6.5.3-1.fc39.x86_64 | ||
+ | |||
+ | 完了しました! | ||
+ | </ | ||
+ | </WRAP> | ||
===== 動作確認 ===== | ===== 動作確認 ===== | ||
- | <code> | + | <WRAP color_term> |
- | $ hg version | + | <WRAP color_command>< |
- | Mercurial - 分散構成管理ツール(バージョン | + | <font color="# |
- | (詳細は | + | </ |
+ | <WRAP color_result>< | ||
+ | Mercurial - 分散構成管理ツール(バージョン | ||
+ | (詳細は | ||
- | Copyright (C) 2005-2015 Matt Mackall | + | Copyright (C) 2005-2023 Olivia |
- | 本製品はフリーソフトウェアです。 | + | This is free software; see the source for copying conditions. There is NO |
- | 頒布条件に関しては同梱されるライセンス条項をお読みください。 | + | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
- | 市場適合性や特定用途への可否を含め、 本製品は無保証です。 | + | </ |
- | </code> | + | </WRAP> |
===== 使い方 ===== | ===== 使い方 ===== | ||
==== 初期設定 ==== | ==== 初期設定 ==== | ||
- | <code> | + | <WRAP color_term> |
- | vi ~/.hgrc | + | <WRAP color_command>< |
- | </code> | + | <font color="# |
- | < | + | </ |
+ | もしくは\\ | ||
+ | <WRAP color_command>< | ||
+ | <font color="# | ||
+ | </ | ||
+ | もしくは\\ | ||
+ | <WRAP color_command>< | ||
+ | <font color="# | ||
+ | </pre></ | ||
+ | </ | ||
+ | ※**hg** コマンドのデフォルトエディタは **EDITOR** 変数が設定されていない限りは **vi** である。\\ | ||
+ | 永続的に **nano** に変更する場合は、以下のように設定を保存する。\\ | ||
+ | |||
+ | **zsh**\\ | ||
+ | <WRAP color_term> | ||
+ | <WRAP color_command>< | ||
+ | <font color="# | ||
+ | <font color="# | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | **Bash**\\ | ||
+ | <WRAP color_term> | ||
+ | <WRAP color_command>< | ||
+ | <font color="# | ||
+ | <font color="# | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | Mercurial のユーザー名を設定する🤔\\ | ||
+ | <WRAP color_term> | ||
+ | <WRAP color_command>< | ||
+ | <font color="# | ||
+ | </ | ||
+ | <WRAP color_mincode> | ||
[ui] | [ui] | ||
username = Tomoyan < | username = Tomoyan < | ||
- | </ | + | </code></ |
+ | </WRAP> | ||
==== リポジトリの作成 ==== | ==== リポジトリの作成 ==== | ||
既存のディレクトリでリポジトリを作成する。 | 既存のディレクトリでリポジトリを作成する。 | ||
- | <code> | + | <WRAP color_term> |
- | $ mkdir repos | + | <WRAP color_command>< |
- | $ cd repos | + | <font color="# |
- | $ hg init | + | <font color="# |
- | </code> | + | </pre></ |
+ | </WRAP> | ||
新たにリポジトリのディレクトリを作成する。 | 新たにリポジトリのディレクトリを作成する。 | ||
- | <code> | + | <WRAP color_term> |
- | $ hg init repos | + | <WRAP color_command>< |
- | </code> | + | <font color="# |
+ | </pre></ | ||
+ | </WRAP> | ||
==== ソース管理から除外するファイルの設定 ==== | ==== ソース管理から除外するファイルの設定 ==== | ||
- | <code> | + | <WRAP color_term> |
- | $ vi .hgignore | + | <WRAP color_command>< |
- | </code> | + | <font color="# |
- | <code autoconf> | + | </pre></ |
+ | </ | ||
+ | <WRAP color_term> | ||
+ | <WRAP color_mincode> | ||
# Shell 形式パターンマッチ | # Shell 形式パターンマッチ | ||
syntax: glob | syntax: glob | ||
行 62: | 行 197: | ||
*.pyc | *.pyc | ||
</ | </ | ||
- | <code autoconf> | + | <code autoconf |
# 正規表現パターンマッチ | # 正規表現パターンマッチ | ||
syntax: regexp | syntax: regexp | ||
^\.git/ | ^\.git/ | ||
- | </ | + | </code></ |
+ | </WRAP> | ||
==== ファイルの追加 ==== | ==== ファイルの追加 ==== | ||
- | <code> | + | <WRAP color_term> |
- | $ hg add file.txt | + | <WRAP color_command>< |
- | </code> | + | <font color="# |
+ | </pre></ | ||
+ | </WRAP> | ||
==== ステータスの確認 ==== | ==== ステータスの確認 ==== | ||
- | <code> | + | <WRAP color_term> |
- | $ hg status | + | <WRAP color_command>< |
+ | <font color="# | ||
+ | </ | ||
+ | <WRAP color_result>< | ||
A file.txt | A file.txt | ||
- | </code> | + | </pre></ |
+ | </WRAP> | ||
==== コミット ==== | ==== コミット ==== | ||
行 106: | 行 248: | ||
==== リモートリポジトリの複製 ==== | ==== リモートリポジトリの複製 ==== | ||
- | ssh経由でリモートリポジトリをローカルに複製する。 | + | ssh 経由でリモートリポジトリをローカルに複製する。 |
- | <code> | + | <WRAP color_term> |
- | $ hg clone ssh:// | + | <WRAP color_command>< |
- | </code> | + | <font color="# |
+ | </pre></ | ||
+ | </WRAP> | ||
==== リモートリポジトリの変更取得 ==== | ==== リモートリポジトリの変更取得 ==== | ||
行 125: | 行 269: | ||
$ hg push ssh:// | $ hg push ssh:// | ||
</ | </ | ||
- | ※push先にリポジトリが存在している必要がある。存在しない場合は作成するかcloneしておくこと。\\ | + | ※push 先にリポジトリが存在している必要がある。存在しない場合は作成しておくこと。\\ |
- | \\ | + | < |
+ | $ ssh user@server -p22 hg init / | ||
+ | </ | ||
.hg/hgrc に以下の記載があるなら省略できる。 | .hg/hgrc に以下の記載があるなら省略できる。 | ||
行 136: | 行 282: | ||
$ hg push | $ hg push | ||
</ | </ | ||
- | \\ | ||
- | サーバーでリポジトリを作成する場合。 | + | サーバーでリポジトリを作成する場合。\\ |
+ | クライアントからサーバーへクローンすることもできるが...\\ | ||
< | < | ||
$ hg init fuga | $ hg init fuga | ||
- | </ | ||
- | \\ | ||
- | |||
- | クライアントからサーバーへクローンする場合。 | ||
- | < | ||
$ hg clone . ssh:// | $ hg clone . ssh:// | ||
</ | </ | ||
行 162: | 行 303: | ||
< | < | ||
$ hg convert [repository] [new-repository] | $ hg convert [repository] [new-repository] | ||
+ | 変換先リポジトリ new-repository の初期化中 | ||
+ | 変換元リポジトリの走査中... | ||
+ | 並べ替え中... | ||
+ | 変換中... | ||
+ | 9625 Initial structure | ||
+ | 〜省略〜 | ||
$ cd new-repository | $ cd new-repository | ||
$ hg update | $ hg update | ||
</ | </ | ||
+ | |||
+ | ==== Subversion のリポジトリ を Mercurial へリポジトリ変換 ==== | ||
+ | hg convert で svn を Mercurial に変換する。\\ | ||
+ | < | ||
+ | $ hg convert _wxHexEditor-v0.23-src_svn _wxHexEditor-v0.23-src_hg | ||
+ | 変換先リポジトリ _wxHexEditor-v0.23-src_hg の初期化中 | ||
+ | 変換元リポジトリの走査中... | ||
+ | 並べ替え中... | ||
+ | 変換中... | ||
+ | $ cd _wxHexEditor-v0.23-src_hg | ||
+ | $ hg update | ||
+ | </ | ||
+ | |||
+ | === Subversion のリポジトリがリモートにしかない場合 === | ||
+ | git-svn を使って svn を一度 git に変換する。\\ | ||
+ | < | ||
+ | $ sudo dnf install git-svn | ||
+ | $ git svn clone https:// | ||
+ | Initialized empty Git repository in / | ||
+ | A testfile | ||
+ | A HexEditorCtrl/ | ||
+ | A HexEditorCtrl/ | ||
+ | 〜省略〜 | ||
+ | W: -empty_dir: contrib/ | ||
+ | r464 = 9d76f35dbaf4053a5b90771b65147d5a940f0fca (refs/ | ||
+ | Checked out HEAD: | ||
+ | https:// | ||
+ | creating empty directory: mhash/ | ||
+ | </ | ||
+ | hg convert で git を Mercurial に変換する。\\ | ||
+ | < | ||
+ | $ hg convert wxHexEditor-v0.23-src_git wxHexEditor-v0.23-src_hg | ||
+ | 変換先リポジトリ wxHexEditor-v0.23-src_hg の初期化中 | ||
+ | 変換元リポジトリの走査中... | ||
+ | 並べ替え中... | ||
+ | 変換中... | ||
+ | 435 Reset svn | ||
+ | 434 DataInterpreter Added. | ||
+ | 433 DataInterpreter big endian and unsigned swithces fixed. | ||
+ | 〜省略〜 | ||
+ | 2 Last touches for wxMSW. | ||
+ | 1 Fixed assertions due ~wxHexCtrl() cleanup code. | ||
+ | 0 Updated to v0.23 | ||
+ | ブックマークの更新中 | ||
+ | $ cd wxHexEditor-v0.23-src_hg | ||
+ | $ hg update | ||
+ | </ | ||
+ | |||
===== トラブルシューティング ===== | ===== トラブルシューティング ===== | ||
+ | |||
+ | ===== 信頼できないファイル .hg/hgrc (所有者 root, グループ root)と言われる ===== | ||
+ | hgrc の所有者やグループが自分ではない時に発生する。\\ | ||
+ | 表示される所有者やグループが本当に信頼できるものであれば、~/ | ||
+ | < | ||
+ | $ vi ~/.hgrc | ||
+ | </ | ||
+ | <file ini ~/.hgrc> | ||
+ | [trusted] | ||
+ | users = root | ||
+ | groups = root | ||
+ | </ | ||
==== インストール時に「gcc: | ==== インストール時に「gcc: | ||
行 184: | 行 391: | ||
[[http:// | [[http:// | ||
[[https:// | [[https:// | ||
+ | [[https:// | ||
+ |