centos8にmercurialをインストールする

centos8にmercurialをインストールする

centos8にバージョン管理ツールであるmercurialをインストールするまでの手順を記述してます。CentOSのバージョンはStream release 8となります。

環境

  • OS CentOS Stream release 8
  • python 3.9.2
  • pip 21.0.1
  • Mercurial 5.7.1

事前準備

pythonをインストールしておきます。

mercurialインストール

pipでインストール可能です。

pip3.9 install mercurial

<出力結果>
Defaulting to user installation because normal site-packages is not writeable
Collecting mercurial
  Downloading mercurial-5.7.1.tar.gz (7.9 MB)
     |████████████████████████████████| 7.9 MB 127 kB/s 
Using legacy 'setup.py install' for mercurial, since package 'wheel' is not installed.
Installing collected packages: mercurial
    Running setup.py install for mercurial ... done
Successfully installed mercurial-5.7.1

インストールが完了したのでバージョンを確認してみます。

hg --version

<出力結果>
Mercurial - 分散構成管理ツール(バージョン 5.7.1)
(詳細は https://mercurial-scm.org を参照)

Copyright (C) 2005-2021 Matt Mackall and others
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

mercurial使い方

リポジトリの作成は、gitと同じで「init」で作成できます

 hg init

「.hg」が作成されます。

ファイルを作成して、addしてみます。

touch hoge.txt

hg add hoge.txt

コミットしてみます。

hg commit -m "first commit"

<出力結果>
中止: ユーザ名が未指定です
('hg config --edit' 実行でユーザ名を設定してください)

ユーザー名の設定が必要なようなため、いわれた通り以下のコマンドを実行して、ユーザーを指定します。

hg config --edit

ここでは「testuser」としてます。

これでコミットができるようになります。

hg commit -m "first commit"

コミット履歴は以下で確認可能です。

hg log

<出力結果>
リビジョン:   0:14b336a00bcc
タグ:         tip
ユーザ:       testuser
日付:         Wed Mar 10 11:17:40 2021 +0900
要約:         first commit