3

git log --first-parentマージコミットの最初の親を除くすべてを省略します。

例:

$ git log --oneline --graph

* 087f5ed Master C
*   36c50a2 Merge branch 'feature'
|\  
| * 98c89df Feature B
| * 89b3a7b Feature A
* | 9a95133 Master B
|/  
* 766c9b0 Master A

$ git log --oneline --graph --first-parent

* 087f5ed Master C
* 36c50a2 Merge branch 'feature'
* 9a95133 Master B
* 766c9b0 Master A

Mercurialに相当するものはありますか?

4

4 に答える 4

1
>hg glog -r 410:426 --template "{rev} - {desc|firstline|fill68}\n"
o    426 - Merge test fixes for dulwich changes and output changes.
|\
| o    425 - Merge incoming fix.
| |\
| | o  424 - getremotechanges: fix incoming support
| | |
o | |  423 - overlay: stop using deprecated tree.entries() method
| | |
| o |  422 - Fix all-version-tests.
| | |
o | |  421 - Test output format tweaks for test-outgoing.
| | |
o | |  420 - test-incoming: fixes for hg 1.7
| | |
| o |    419 - Merge fix for `hg out` failing on empty repo.
| |\ \
| | o |  418 - In some situations where a reference is being used but does not
| | | |  exist in _map_git or _map_hg, silently skip the reference rather
| | | |  than throwing an error. This allows hg outgoing to work on
| | | |  repositories which do not contain any revisions at all.
| o | |  417 - only want heads and tags
| |/ /
| o |  416 - test-url-parsing: update expecations missed by edaadbd99074
| | |
| o |  415 - to be recognized port number in path to repository
| | |
| o |  414 - Unbreak outgoing to non-git repos with hg pre-1.9
| | |
| o |  413 - test fixes for progress cleanup
| |/
| o  412 - Fix mercurial issue2855
| |
| o  411 - Convert dulwich progress into mercurial ui.progress
|/
o  410 - test-incoming: only run on hg 1.7.x and newer

Gist から極端に退化したケースの代わりに、実際のリポジトリ DAG (hg-git リポジトリ) の一部を使用します。この選択が、解決しようとしている問題を十分に示していることを願っています。

必要なリビジョンセット (平易な英語) は

「2 番目の親のない範囲 A:B で、マージセットの先祖です」

revset 関数型言語 (TBT!)

-r "410::426 - (p2(merge()) or ancestors(p2(merge())))"

ソースとしての変更セットの全範囲の場合、より読みやすい形式は次のようになります

hg log -r "!(p2(merge()) or ancestors(p2(merge())))"

編集 1

私はrevsetをテストし、方法論について再考しました(除外するのではなく、空のセットに必要なものだけを追加したい)、今のところ私のユースケースの最も近い反復(バグがあり、解決策が見つからない)は

(p1(ancestors(p1(426))) or p1(426) or 426) and 410::426

(まだ)いくつかの不要なリビジョンが含まれています

ここに画像の説明を入力

于 2013-03-18T10:24:17.517 に答える
1

これにはリビジョンセットを使用できます。

hg log -r "p1(merge())"

merge()すべてのマージ コミットをp1()取得し、それらのコミットの最初の親を取得します。

hg help revsetsリビジョンセットに関する詳細情報を取得するために使用します。

于 2013-03-13T08:31:28.503 に答える
0

hg log --follow-firstいくつかの規定を使用して、ほぼ同じことを行うようです:

  1. 非推奨です(私が見つけることができる説明はありません)。

  2. 現在の変更セットからの直線的な履歴以外のものを表示する方法がわかりません (たとえば、2 つの発散ヘッドからの最初の親に続く履歴を表示します (と同等git log --first-parent branch-a branch-b)。ただし、これは単にMercurial に関する私の知識不足。

  3. 空の支線が次のように表示されますhg log -G

    $ hg log -G --template '{node|short} {desc|firstline}'
    
    @  51b90923fc9d Master C
    |
    o    bb51d979fd68 Merge branch 'feature'
    |\
    | o  a9ca2597ebbc Feature B
    | |
    | o  d0a54af09272 Feature A
    | |
    o |  77ceb31100be Master B
    |/
    o  b5a0b2c7468f Master A
    
    $ hg log -G --template '{node|short} {desc|firstline}' --follow-first
    
    @  51b90923fc9d Master C
    |
    o    bb51d979fd68 Merge branch 'feature'
    |\
    o |  77ceb31100be Master B
    |/
    o  b5a0b2c7468f Master A
    

    上記の例はそれほど悪くないように見えるかもしれませんが、この動作が扱いにくい出力をレンダリングする例については、 https://gist.github.com/MaxNanasy/5184202を参照してください。

    問題#2が克服できない場合、この問題はあまり問題にならない可能性があります。それhg logがなければ、 AFAICT-Gを使用する唯一の有用な方法になるからです。--follow-first

于 2013-03-18T00:40:55.177 に答える