差分
このページの2つのバージョン間の差分を表示します。
| 両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン | ||
| python:mercurial [2020/12/17 02:43] – [リモートリポジトリへ変更反映] ともやん | python:mercurial [2024/03/14 09:30] (現在) – ともやん | ||
|---|---|---|---|
| 行 1: | 行 1: | ||
| ====== Mercurial - 分散型バージョン管理システム ====== | ====== Mercurial - 分散型バージョン管理システム ====== | ||
| 本家: [[https:// | 本家: [[https:// | ||
| + | |||
| + | 関連: [[linux: | ||
| ===== 前提条件 ===== | ===== 前提条件 ===== | ||
| 行 8: | 行 10: | ||
| [[python: | [[python: | ||
| - | CentOS | + | Fedora |
| - | <code> | + | <WRAP color_term> |
| - | $ sudo yum install gcc python-devel | + | <WRAP color_command>< |
| - | </code> | + | <font color="# |
| + | </pre></ | ||
| + | </WRAP> | ||
| ===== インストール ===== | ===== インストール ===== | ||
| **pip** によるインストール。\\ | **pip** によるインストール。\\ | ||
| - | <code> | + | <WRAP color_term> |
| - | $ sudo pip install mercurial | + | <WRAP color_command>< |
| - | </code> | + | <font color="# |
| - | < | + | </ |
| - | <code> | + | <WRAP color_result>< |
| - | WARNING: Running pip install with root privileges is generally not a good idea. Try `pip install --user` instead. | + | |
| Collecting mercurial | Collecting mercurial | ||
| - | Downloading | + | Downloading |
| - | |████████████████████████████████| 7.5MB 1.2MB/s | + | < |
| + | Installing build dependencies | ||
| + | Getting requirements to build wheel ... done | ||
| + | Preparing metadata | ||
| + | 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 | Installing collected packages: mercurial | ||
| - | Running setup.py install | + | Successfully installed mercurial-6.6.3 |
| - | Successfully installed mercurial-5.3.2 | + | </ |
| - | </code> | + | </ |
| + | |||
| + | **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>< | ||
| + | / | ||
| + | </pre></ | ||
| </ | </ | ||
| **dnf** によるインストール。\\ | **dnf** によるインストール。\\ | ||
| - | <code> | + | <WRAP color_term> |
| - | $ sudo dnf install | + | <WRAP color_command>< |
| - | </code> | + | <font color="# |
| - | < | + | </ |
| - | <code> | + | <WRAP color_result_long>< |
| - | メタデータの期限切れの最終確認: | + | メタデータの期限切れの最終確認: |
| 依存関係が解決しました。 | 依存関係が解決しました。 | ||
| - | ==================================================================================================== | + | ============================================================================================================== |
| - | Package | + | パッケージ |
| - | ==================================================================================================== | + | ============================================================================================================== |
| インストール: | インストール: | ||
| - | | + | <font color="# |
| 依存関係のインストール: | 依存関係のインストール: | ||
| - | mercurial-lang x86_64 | + | <font color="# |
| トランザクションの概要 | トランザクションの概要 | ||
| - | ==================================================================================================== | + | ============================================================================================================== |
| インストール | インストール | ||
| - | ダウンロードサイズの合計: | + | ダウンロードサイズの合計: |
| - | インストール済みのサイズ: | + | インストール後のサイズ: |
| - | これでよろしいですか? | + | |
| パッケージのダウンロード: | パッケージのダウンロード: | ||
| - | (1/ | + | (1/ |
| - | (2/2): mercurial-py3-5.2-5.fc32.x86_64.rpm | + | (2/2): mercurial-6.5.3-1.fc39.x86_64.rpm |
| - | ---------------------------------------------------------------------------------------------------- | + | -------------------------------------------------------------------------------------------------------------- |
| - | 合計 | + | 合計 |
| トランザクションの確認を実行中 | トランザクションの確認を実行中 | ||
| トランザクションの確認に成功しました。 | トランザクションの確認に成功しました。 | ||
| 行 63: | 行 93: | ||
| トランザクションのテストに成功しました。 | トランザクションのテストに成功しました。 | ||
| トランザクションを実行中 | トランザクションを実行中 | ||
| - | 準備 | + | 準備 |
| - | インストール中 | + | インストール中 |
| - | インストール中 | + | インストール中 |
| - | scriptletの実行中: | + | scriptletの実行中: |
| - | 検証 | + | 検証 |
| - | 検証 | + | 検証 |
| インストール済み: | インストール済み: | ||
| - | mercurial-lang-5.2-5.fc32.x86_64 | + | mercurial-6.5.3-1.fc39.x86_64 |
| 完了しました! | 完了しました! | ||
| - | </code> | + | </pre></ |
| </ | </ | ||
| ===== 動作確認 ===== | ===== 動作確認 ===== | ||
| - | <code> | + | <WRAP color_term> |
| - | $ hg version | + | <WRAP color_command>< |
| - | </code> | + | <font color="# |
| - | < | + | </pre></ |
| - | <code> | + | <WRAP color_result>< |
| - | Mercurial | + | Mercurial |
| - | (see https:// | + | (詳細は |
| - | Copyright (C) 2005-2019 Matt Mackall and others | + | Copyright (C) 2005-2023 Olivia |
| This is free software; see the source for copying conditions. There is NO | This is free software; see the source for copying conditions. There is NO | ||
| warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| - | </code> | + | </pre></ |
| </ | </ | ||
| 行 95: | 行 125: | ||
| ==== 初期設定 ==== | ==== 初期設定 ==== | ||
| - | < | + | < |
| - | <code> | + | <WRAP color_command>< |
| - | $ hg config --edit | + | <font color="# |
| - | </code> | + | </pre></ |
| + | もしくは\\ | ||
| + | <WRAP color_command>< | ||
| + | <font color="# | ||
| + | </ | ||
| もしくは\\ | もしくは\\ | ||
| - | <code> | + | <WRAP color_command>< |
| - | $ vi ~/.hgrc | + | <font color="# |
| - | </code> | + | </pre></ |
| </ | </ | ||
| - | < | + | ※**hg** コマンドのデフォルトエディタは **EDITOR** 変数が設定されていない限りは **vi** である。\\ |
| - | <code ini ~/.hgrc> | + | 永続的に **nano** に変更する場合は、以下のように設定を保存する。\\ |
| + | |||
| + | **zsh**\\ | ||
| + | < | ||
| + | <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></ |
| </ | </ | ||
| - | ※**hg** コマンドのデフォルトエディタは **EDITOR** 変数が設定されていない限りは **vi** である。\\ | ||
| - | **nano** に変更する場合は以下のように実行する。\\ | ||
| - | < | ||
| - | $ EDITOR=nano hg config --edit | ||
| - | </ | ||
| - | もしくは、**.bashrc** に設定を保存する。\\ | ||
| - | < | ||
| - | $ echo ' | ||
| - | $ . ~/.bashrc | ||
| - | </ | ||
| ==== リポジトリの作成 ==== | ==== リポジトリの作成 ==== | ||
| 既存のディレクトリでリポジトリを作成する。 | 既存のディレクトリでリポジトリを作成する。 | ||
| - | <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_command>< |
| - | $ vi .hgignore | + | <font color="# |
| - | </code> | + | </pre></ |
| </ | </ | ||
| - | < | + | < |
| - | <code autoconf .hgignore> | + | <WRAP color_mincode> |
| # Shell 形式パターンマッチ | # Shell 形式パターンマッチ | ||
| syntax: glob | syntax: glob | ||
| 行 152: | 行 202: | ||
| ^\.git/ | ^\.git/ | ||
| - | </ | + | </code></ |
| </ | </ | ||
| ==== ファイルの追加 ==== | ==== ファイルの追加 ==== | ||
| - | <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> | ||
| ==== コミット ==== | ==== コミット ==== | ||
| - | <code> | + | <WRAP color_term> |
| - | $ hg commit | + | <WRAP color_command>< |
| - | </code> | + | <font color="# |
| + | </pre></ | ||
| + | </WRAP> | ||
| ==== 差分表示 ==== | ==== 差分表示 ==== | ||
| - | <code> | + | <WRAP color_term> |
| - | $ hg diff | + | <WRAP color_command>< |
| - | </code> | + | <font color="# |
| + | </pre></ | ||
| + | </WRAP> | ||
| ==== 編集取り消し ==== | ==== 編集取り消し ==== | ||
| - | <code> | + | <WRAP color_term> |
| - | $ hg revert file.txt | + | <WRAP color_command>< |
| - | </code> | + | <font color="# |
| + | </pre></ | ||
| + | </WRAP> | ||
| ==== コミット取り消し ==== | ==== コミット取り消し ==== | ||
| - | <code> | + | <WRAP color_term> |
| - | $ hg rollback | + | <WRAP color_command>< |
| - | </code> | + | <font color="# |
| + | </pre></ | ||
| + | </WRAP> | ||
| ==== コミットログ表示 ==== | ==== コミットログ表示 ==== | ||
| - | <code> | + | <WRAP color_term> |
| - | $ hg log | + | <WRAP color_command>< |
| - | </code> | + | <font color="# |
| + | </pre></ | ||
| + | </WRAP> | ||
| ==== リモートリポジトリの複製 ==== | ==== リモートリポジトリの複製 ==== | ||
| - | ssh経由でリモートリポジトリをローカルに複製する。 | + | ssh 経由でリモートリポジトリをローカルに複製する。 |
| - | <code> | + | <WRAP color_term> |
| - | $ hg clone ssh:// | + | <WRAP color_command>< |
| - | </code> | + | <font color="# |
| + | </pre></ | ||
| + | </WRAP> | ||
| ==== リモートリポジトリの変更取得 ==== | ==== リモートリポジトリの変更取得 ==== | ||
| - | <code> | + | <WRAP color_term> |
| - | $ hg pull | + | <WRAP color_command>< |
| - | $ hg update | + | <font color="# |
| - | </code> | + | <font color="# |
| + | </pre></ | ||
| + | </ | ||
| 作業領域の変更を破棄する場合 | 作業領域の変更を破棄する場合 | ||
| - | <code> | + | <WRAP color_term> |
| - | $ hg update -C | + | <WRAP color_command>< |
| - | </code> | + | <font color="# |
| + | </ | ||
| + | </WRAP> | ||
| ==== リモートリポジトリへ変更反映 ==== | ==== リモートリポジトリへ変更反映 ==== | ||
| - | <code> | + | <WRAP color_term> |
| - | $ hg push ssh:// | + | <WRAP color_command>< |
| - | </code> | + | <font color="# |
| + | </pre></ | ||
| + | </WRAP> | ||
| ※push 先にリポジトリが存在している必要がある。存在しない場合は作成しておくこと。\\ | ※push 先にリポジトリが存在している必要がある。存在しない場合は作成しておくこと。\\ | ||
| - | <code> | + | <WRAP color_term> |
| - | $ ssh user@server -p22 hg init / | + | <WRAP color_command>< |
| - | </code> | + | <font color="# |
| + | </pre></ | ||
| + | </WRAP> | ||
| - | .hg/hgrc に以下の記載があるなら省略できる。 | + | < |
| - | < | + | <WRAP color_term> |
| + | <WRAP color_mincode> | ||
| [paths] | [paths] | ||
| default = ssh:// | default = ssh:// | ||
| - | </ | + | </code></ |
| - | <code> | + | <WRAP color_command>< |
| - | $ hg push | + | <font color="# |
| - | </code> | + | </pre></ |
| + | </WRAP> | ||
| - | サーバーでリポジトリを作成する場合。 | + | サーバーでリポジトリを作成する場合。\\ |
| - | < | + | クライアントからサーバーへクローンすることもできるが...\\ |
| - | $ hg init fuga | + | <WRAP color_term> |
| - | </ | + | <WRAP color_command>< |
| - | クライアントからサーバーへクローンすることもできる。 | + | <font color="# |
| - | <code> | + | <font color="# |
| - | $ hg clone . ssh:// | + | </pre></ |
| - | </code> | + | </WRAP> |
| ==== git を Mercurial へリポジトリ変換 ==== | ==== git を Mercurial へリポジトリ変換 ==== | ||
| convert エクステンションを有効化する。\\ | convert エクステンションを有効化する。\\ | ||
| - | <code> | + | <WRAP color_term> |
| - | $ vi ~/.hgrc | + | <WRAP color_command>< |
| - | </code> | + | <font color="# |
| - | <file ini ~/.hgrc> | + | </pre></ |
| + | <WRAP color_mincode>< | ||
| [extensions] | [extensions] | ||
| convert = | convert = | ||
| - | </ | + | </file></ |
| + | </WRAP> | ||
| git を Mercurial へ変換\\ | git を Mercurial へ変換\\ | ||
| - | <code> | + | <WRAP color_term> |
| - | $ hg convert [repository] [new-repository] | + | <WRAP color_command>< |
| + | <font color="# | ||
| + | </ | ||
| + | <WRAP color_result>< | ||
| 変換先リポジトリ new-repository の初期化中 | 変換先リポジトリ new-repository の初期化中 | ||
| 変換元リポジトリの走査中... | 変換元リポジトリの走査中... | ||
| 行 253: | 行 337: | ||
| 9625 Initial structure | 9625 Initial structure | ||
| 〜省略〜 | 〜省略〜 | ||
| - | $ cd new-repository | + | </ |
| - | $ hg update | + | <WRAP color_command>< |
| - | </code> | + | <font color="# |
| + | <font color="# | ||
| + | </pre></ | ||
| + | </WRAP> | ||
| ==== Subversion のリポジトリ を Mercurial へリポジトリ変換 ==== | ==== Subversion のリポジトリ を Mercurial へリポジトリ変換 ==== | ||
| hg convert で svn を Mercurial に変換する。\\ | hg convert で svn を Mercurial に変換する。\\ | ||
| - | <code> | + | <WRAP color_term> |
| - | $ hg convert _wxHexEditor-v0.23-src_svn _wxHexEditor-v0.23-src_hg | + | <WRAP color_command>< |
| + | <font color="# | ||
| + | </ | ||
| + | <WRAP color_result>< | ||
| 変換先リポジトリ _wxHexEditor-v0.23-src_hg の初期化中 | 変換先リポジトリ _wxHexEditor-v0.23-src_hg の初期化中 | ||
| 変換元リポジトリの走査中... | 変換元リポジトリの走査中... | ||
| 並べ替え中... | 並べ替え中... | ||
| 変換中... | 変換中... | ||
| - | $ cd _wxHexEditor-v0.23-src_hg | + | </ |
| - | $ hg update | + | <WRAP color_command>< |
| - | </code> | + | <font color="# |
| + | <font color="# | ||
| + | </pre></ | ||
| + | </WRAP> | ||
| === Subversion のリポジトリがリモートにしかない場合 === | === Subversion のリポジトリがリモートにしかない場合 === | ||
| git-svn を使って svn を一度 git に変換する。\\ | git-svn を使って svn を一度 git に変換する。\\ | ||
| - | <code> | + | <WRAP color_term> |
| - | $ sudo dnf install git-svn | + | <WRAP color_command>< |
| - | $ git svn clone https:// | + | <font color="# |
| + | <font color="# | ||
| + | </ | ||
| + | <WRAP color_result>< | ||
| Initialized empty Git repository in / | Initialized empty Git repository in / | ||
| A testfile | A testfile | ||
| 行 284: | 行 380: | ||
| https:// | https:// | ||
| creating empty directory: mhash/ | creating empty directory: mhash/ | ||
| - | </code> | + | </pre></ |
| + | </ | ||
| hg convert で git を Mercurial に変換する。\\ | hg convert で git を Mercurial に変換する。\\ | ||
| - | <code> | + | <WRAP color_term> |
| - | $ hg convert wxHexEditor-v0.23-src_git wxHexEditor-v0.23-src_hg | + | <WRAP color_command>< |
| + | <font color="# | ||
| + | </ | ||
| + | <WRAP color_result>< | ||
| 変換先リポジトリ wxHexEditor-v0.23-src_hg の初期化中 | 変換先リポジトリ wxHexEditor-v0.23-src_hg の初期化中 | ||
| 変換元リポジトリの走査中... | 変換元リポジトリの走査中... | ||
| 行 296: | 行 397: | ||
| 433 DataInterpreter big endian and unsigned swithces fixed. | 433 DataInterpreter big endian and unsigned swithces fixed. | ||
| 〜省略〜 | 〜省略〜 | ||
| - | 2 Last touches for wxMSW. | + | 2 Last touches for wxMSW. |
| - | 1 Fixed assertions due ~wxHexCtrl() cleanup code. | + | 1 Fixed assertions due ~wxHexCtrl() cleanup code. |
| - | 0 Updated to v0.23 | + | 0 Updated to v0.23 |
| ブックマークの更新中 | ブックマークの更新中 | ||
| - | $ cd wxHexEditor-v0.23-src_hg | + | </ |
| - | $ hg update | + | <WRAP color_command>< |
| - | </code> | + | <font color="# |
| - | + | <font color="# | |
| + | </pre></ | ||
| + | </ | ||
| ===== トラブルシューティング ===== | ===== トラブルシューティング ===== | ||
| 行 311: | 行 413: | ||
| hgrc の所有者やグループが自分ではない時に発生する。\\ | hgrc の所有者やグループが自分ではない時に発生する。\\ | ||
| 表示される所有者やグループが本当に信頼できるものであれば、~/ | 表示される所有者やグループが本当に信頼できるものであれば、~/ | ||
| - | <code> | + | <WRAP color_term> |
| - | $ vi ~/.hgrc | + | <WRAP color_command>< |
| - | </code> | + | <font color="# |
| - | <file ini ~/.hgrc> | + | </pre></ |
| + | <WRAP color_mincode> | ||
| [trusted] | [trusted] | ||
| users = root | users = root | ||
| groups = root | groups = root | ||
| - | </ | + | </file></ |
| + | </WRAP> | ||
| ==== インストール時に「gcc: | ==== インストール時に「gcc: | ||
| 行 325: | 行 429: | ||
| \\ | \\ | ||
| redhat-rpm-config パッケージをインストールしてから行う。 | redhat-rpm-config パッケージをインストールしてから行う。 | ||
| - | <code> | + | <WRAP color_term> |
| - | $ sudo dnf install redhat-rpm-config | + | <WRAP color_command>< |
| - | </code> | + | <font color="# |
| + | </pre></ | ||
| + | </WRAP> | ||
| ===== 参考文献 ===== | ===== 参考文献 ===== | ||
| 行 335: | 行 441: | ||
| [[http:// | [[http:// | ||
| [[https:// | [[https:// | ||
| + | [[https:// | ||
| + | |||