藤原です。
hgflow 側の挙動/実装までは確認できてませんが、おそらくブランチ
名 (ストリーム名) に "#" を使っているのが問題かと。
Mercurial に対するリビジョン指定がどのように解釈されるかは、-v 付
きで hg debugrevspec コマンドを使って調べることができます。
件のブランチ名 feature/#24057_crypt を指定すると:
$ hg debugrevspec -v feature/#24057_crypt
(relation
(symbol 'feature/')
(symbol '24057_crypt'))
hg: parse error: can't use a relation in this context
"#" が「'feature/' と '24057_crypt' を伴った relation 述語の使用」
による revspec 式であるとみなされていることがわかります。
ちなみに "#" を relation 述語として扱うのは未公開の試験的実装です
ので、おおひらさんが知らないのも無理はありません。
https://www.mercurial-scm.org/repo/hg/file/tip/mercurial/revset.py#l285
"hg flow" と "hg update" で認識の可否が異なるのは、おそらく指定さ
れた「文字列」からリビジョンを特定する際の処理手順が異なるのでは
ないかと思われます。
Mercurial での標準的なリビジョン指定文字列の解釈手順では、最初に
指定文字列全体が、タグ、ブランチ、その他既知のラベルと一致してい
るかを確認します。"hg update" はこの手順により、存在するブランチ
名と一致する feature/#24057_crypt を、当該ブランチの最新リビジョ
ンと解釈している筈です。scmutil.py の revsingle() 等を呼び出すルー
トがこれに該当します。
一方 "hg flow" の方は、おそらく上記「既知の名称との一致」判定が実
施されない内部 API を呼び出してしまっているのではないかと思われま
す (あるいは Mercurial 側の実装変更の影響でそうなってしまった?)。
"hg debugrevspec" も、「既知の名称との一致」判定をせずに指定文字
列全体を「revset 式」とみなして処理しているため、ブランチ名中の
"#" を relation 述語と解釈しているわけですね。
文字列をクォートすることで、revset 式としての解釈を回避し、指定文
字列が1つのラベルであることを Mercurial に示すことができます。
$ hg debugrevspec -v "'feature/#24057_crypt'"
(string 'feature/#24057_crypt')
abort: unknown revision 'feature/#24057_crypt'!
bash や cmd.exe 等のシェルがクォートを「解釈」してしまうため、外
側ダブルクォート、内側シングルクォートの、二重指定になっている点
に注意してください (フォント設定によっては分かりづらいかも?)。
上記の実行結果では、こちらの環境に feature/#24057_crypt ブランチ
が存在しないことで、unknown revision 扱いにこそなっていますが、指
定文字列全体が1つのラベル扱いされていることがわかります。
"hg flow" にブランチ名を指定する際にも同様にブランチ名をクォート
してみてもらえますか?
2019年3月15日(金) 12:10 ohira <
shin....@gmail.com>:
>
> いつもお世話になっております。
> おおひらです。
>
> hgflow を使用してブランチを移動する場合に、特定のブランチでエラーになります。
>
> [shin@faith] ~/repos/trunk/sps_25% hg flow not_exist_branch
> flow: error: Stream not found: <not_exist_branch>
> [shin@faith] ~/repos/trunk/sps_25%
>
> 上のように、実際に存在しないブランチであればエラーになるのは正常ですが、
> hg update <ブランチ> では 正常に移動できるブランチであっても、 hg flow <ブランチ> ではエラーになる場合が稀にあるのです。
>
> 特定のブランチで稀に発生する現象ですが、windowsでもunixでも同様に同じブランチでエラーになります。
>
> 発生箇所は
> hgflow/src/hgflow.py", line 2467, in flow
> stream = Stream.gen( ui, repo, stream, check = True )
> hgflow/src/hgflow.py", line 664, in gen
> raise AbortFlow( "Stream not found: %s" % stream, note = note )
> のあたりのようで、正しいストリームか判断する部分で何故か誤判定してしまうようです。
>
> hgflow は hg update tip を実行して最新のブランチ(まだdefautにマージされていない)flow: version 0.9.8.4の最新を使っています。
>
> [質問1]
> おそらくhgflowの問題なのではと思いますが、
> もしかしたら、ブランチの状態が微妙に違うのかもしれません。
> 正常に使えるブランチと正常に使えないブランチの違いを hg のコマンドで調べる方法はありますでしょうか?
>
> [質問2]
> エクステンションのデバックのはどうするのが良いのかわかりません。
> print文追加して実行とかしてみましたが、状況がわからず。
> hgflowのようなエクステンションの動作をpycharmでデバックすることはできますでしょうか?
>
>
> windows の場合
> C:\Users\v530\repos\trunk\sps_25>ver
>
> Microsoft Windows [Version 10.0.17763.292]
>
> C:\Users\v530\repos\trunk\sps_25>hg version
> Mercurial - 分散構成管理ツール(バージョン 4.9)
> (詳細は
https://mercurial-scm.org を参照)
>
> Copyright (C) 2005-2019 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.
>
> C:\Users\v530\repos\trunk\sps_25>hg flow version
> flow: version 0.9.8.4
>
>
> C:\Users\v530\repos\trunk\sps_25>
> C:\Users\v530\repos\trunk\sps_25>hg update feature/sns_login
> ファイルの更新数 565、 マージ数 0、 削除数 42、 衝突未解消数 0
>
> C:\Users\v530\repos\trunk\sps_25>hg flow feature/sns_login
> flow: Parent of working directory: 28263:12731f764700
> flow: <feature/sns_login> trunk: feature/sns_login
> flow: Open <feature/sns_login> branches:
> flow: feature/sns_login* 28263:12731f764700
>
>
> C:\Users\v530\repos\trunk\sps_25>hg update feature/sns_login_not_exist
> 中止: 'feature/sns_login_not_exist' は未知のリビジョンです!
>
> C:\Users\v530\repos\trunk\sps_25>hg flow feature/sns_login_not_exist
> flow: error: Stream not found: <feature/sns_login_not_exist>
>
> C:\Users\v530\repos\trunk\sps_25>
> C:\Users\v530\repos\trunk\sps_25>
>
>
> C:\Users\v530\repos\trunk\sps_25>
> C:\Users\v530\repos\trunk\sps_25>hg update feature/#24057_crypt
> ファイルの更新数 542、 マージ数 0、 削除数 65、 衝突未解消数 0
>
> C:\Users\v530\repos\trunk\sps_25>hg flow feature/#24057_crypt
> flow: error: Stream not found: <feature/#24057_crypt>
>
> C:\Users\v530\repos\trunk\sps_25>
> C:\Users\v530\repos\trunk\sps_25>hg flow feature/#24057_crypt --traceback
> flow: error: Stream not found: <feature/#24057_crypt>
> Traceback (most recent call last):
> File "C:/Users/v530/hgflow/src/hgflow.py", line 2467, in flow
> stream = Stream.gen( ui, repo, stream, check = True )
> File "C:/Users/v530/hgflow/src/hgflow.py", line 664, in gen
> raise AbortFlow( "Stream not found: %s" % stream, note = note )
> hgext_flow.AbortFlow: Aborted hg flow command.
>
>
>
> unixの場合
> [shin@faith] ~/repos/trunk/sps_25%
> [shin@faith] ~/repos/trunk/sps_25% hg version
> Mercurial Distributed SCM (version 4.7.2)
> (see
https://mercurial-scm.org for more information)
>
> Copyright (C) 2005-2018 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.
> [shin@faith] ~/repos/trunk/sps_25%
> [shin@faith] ~/repos/trunk/sps_25% hg flow version
> flow: version 0.9.8.4
> [shin@faith] ~/repos/trunk/sps_25%
> [shin@faith] ~/repos/trunk/sps_25%
>
>
> [shin@faith] ~/repos/trunk/sps_25%
> [shin@faith] ~/repos/trunk/sps_25% hg update feature/sns_login
> 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
> [shin@faith] ~/repos/trunk/sps_25%
> [shin@faith] ~/repos/trunk/sps_25% hg flow feature/sns_login
> flow: Parent of working directory: 28263:12731f764700
> flow: <feature/sns_login> trunk: feature/sns_login
> flow: Open <feature/sns_login> branches:
> flow: feature/sns_login* 28263:12731f764700
>
> [shin@faith] ~/repos/trunk/sps_25%
> [shin@faith] ~/repos/trunk/sps_25% hg update feature/sns_login_not_exist
> abort: unknown revision 'feature/sns_login_not_exist'!
> [shin@faith] ~/repos/trunk/sps_25%
> [shin@faith] ~/repos/trunk/sps_25% hg flow feature/sns_login_not_exist
> flow: error: Stream not found: <feature/sns_login_not_exist>
> [shin@faith] ~/repos/trunk/sps_25%
>
>
> [shin@faith] ~/repos/trunk/sps_25% hg update feature/#24057_crypt
> 542 files updated, 0 files merged, 65 files removed, 0 files unresolved
> [shin@faith] ~/repos/trunk/sps_25%
> [shin@faith] ~/repos/trunk/sps_25% hg flow feature/#24057_crypt
> flow: error: Stream not found: <feature/#24057_crypt>
> [shin@faith] ~/repos/trunk/sps_25%
>
>
> [shin@faith] ~/repos/trunk/sps_25% hg flow feature/#24057_crypt --traceback
> flow: error: Stream not found: <feature/#24057_crypt>
> Traceback (most recent call last):
> File "/usr/home/shin/hgflow/src/hgflow.py", line 2467, in flow
> stream = Stream.gen( ui, repo, stream, check = True )
> File "/usr/home/shin/hgflow/src/hgflow.py", line 664, in gen
> raise AbortFlow( "Stream not found: %s" % stream, note = note )
> hgext_flow.AbortFlow: Aborted hg flow command.
> [shin@faith] ~/repos/trunk/sps_25%
>
>
> --
> from Mercurial 日本語コミュニティ <
mercur...@googlegroups.com>
> ※ ヘルプ表示は
http://groups.google.com/group/mercurial-ja?hl=ja
> ---
> このメールは Google グループのグループ「mercurial-ja」に登録しているユーザーに送られています。
> このグループから退会し、グループからのメールの配信を停止するには
mercurial-ja...@googlegroups.com にメールを送信してください。
> その他のオプションについては
https://groups.google.com/d/optout にアクセスしてください。
--
----------------------------------------------------------------------
FUJIWARA Katsunori(
flying...@gmail.com)