Re: [mercurial-ja:1876] [hgflow] hg flow を使用した特定のブランチへの移動がエラーになる flow: version 0.9.8.4

115 views
Skip to first unread message
Message has been deleted
Message has been deleted
Message has been deleted

Katsunori FUJIWARA

unread,
Mar 17, 2019, 9:40:16 PM3/17/19
to mercurial-ja
藤原です。

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)
Message has been deleted
Message has been deleted

Katsunori FUJIWARA

unread,
Mar 18, 2019, 12:33:10 AM3/18/19
to mercurial-ja
藤原です。

2019年3月18日(月) 12:07 ohira <shin....@gmail.com>:

> 回答ありがとうございます。
> おおひらです。
>
> ブランチ名に#を含むものは、多く使っています。#を使ったブランチでも通常は hg flow <ブランチ名> で利用できています。
>
> hg flow でのエラーは以前は発生していなかったので、最近のバージョンで起こるもののように思います。
>
> hgflow内のエラーの発生箇所
> https://bitbucket.org/yujiewu/hgflow/src/30c5d6cae041d2410d3203504dc7d84ba5fa78ae/src/hgflow.py?at=hotfix%2F0.9.8.4&fileviewer=file-view-default#hgflow.py-2467
>
> hgflow内のエラーの表示箇所
> https://bitbucket.org/yujiewu/hgflow/src/30c5d6cae041d2410d3203504dc7d84ba5fa78ae/src/hgflow.py?at=hotfix%2F0.9.8.4&fileviewer=file-view-default#hgflow.py-664
>
> hg debugrevspec -v を実行してみました。
> 藤原さんの回答にあった結果と違った内容になってしまい
> コメントで囲っても囲わなくてもエラーにならないようです。
> mercurialのバージョンの違いでしょうか。

済みません。実装/挙動周りで勘違いしてました。

私の実行例のものは、該当するブランチが存在しない ⇛ revset 式とし
て評価 ⇛ "#" があるので relation 述語扱いという流れですね。

そちらの環境では当該ブランチが存在しますから、クォートしなくても
「既知のラベル」扱いでリビジョンの引き当てに成功、というのが期待
通りの挙動になります。

で、とある実装のことを思い出したこので、ちょっと試してみてほしいことが
あります。hgflow.py 中の以下の実装において:

def _get_context( repo, rev ) :
# As of hg v4.7, `repo' will raise `error.ProgrammingError' or
`TypeError' when a branch name is passed in as `changeid'.
try :
return repo[rev]
except ((error.ProgrammingError, TypeError) if ("4.7" <=
util.version()) else None) :
return repo[repo.branchtip( rev )]

"return repo[rev]" の部分を以下のように変えた上で動作確認してみてもら
えますか?

return mercurial.scmutil.revsingle( repo, rev )


おそらくこの問題は、localrepository クラスの __getitem__() 実装におけ
る以下のコードパスに由来する「ブランチ名が 20 桁」のケースでのみ発生す
るものではないかと思われます。

def __getitem__(self, changeid):
:
:
elif len(changeid) == 20:
try:
node = changeid
rev = self.changelog.rev(changeid)
except error.FilteredLookupError:
changeid = hex(changeid) # for the error message
raise
except LookupError:
# check if it might have come from damaged dirstate
#
# XXX we could avoid the unfiltered if we had a recognizable
# exception for filtered changeset access
if (self.local()
and changeid in self.unfiltered().dirstate.parents()):
msg = _("working directory has unknown parent '%s'!")
raise error.Abort(msg % short(changeid))
changeid = hex(changeid) # for the error message
raise

https://www.mercurial-scm.org/repo/hg/file/tip/mercurial/localrepo.py#l1298



> unixの場合(少し古いバージョンです)
> [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% hg debugrevspec -v feature/#24057_crypt
> (symbol 'feature/#24057_crypt')
> * set:
> <baseset [29952]>
> 29952
> [shin@faith] ~/repos/trunk/sps_25% hg debugrevspec -v "'ature/#24057_crypt'"
> (string 'feature/#24057_crypt')
> * set:
> <baseset [29952]>
> 29952
> [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%
>
>
> windowsの場合(hgflow.py に追加したデバック用のprint文の表示が付いてしまっています)
> PS 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.
> PS C:\Users\v530\repos\trunk\sps_25>
> PS C:\Users\v530\repos\trunk\sps_25> hg flow version
> flow: version 0.9.8.4
> PS C:\Users\v530\repos\trunk\sps_25>
> PS C:\Users\v530\repos\trunk\sps_25> hg debugrevspec -v feature/#24057_crypt
> (symbol 'feature/#24057_crypt')
> * set:
> <baseset [29952]>
> 29952
> PS C:\Users\v530\repos\trunk\sps_25>
> PS C:\Users\v530\repos\trunk\sps_25> hg debugrevspec -v "'feature/#24057_crypt'"
> (string 'feature/#24057_crypt')
> * set:
> <baseset [29952]>
> 29952
> PS C:\Users\v530\repos\trunk\sps_25> hg flow "'feature/#24057_crypt'"
> string ok
> stream_f=<'feature/#24057_crypt'>
> @0
> AA=None
> abort!!
> flow: error: Stream not found: <'feature/#24057_crypt'>
> PS C:\Users\v530\repos\trunk\sps_25>
>
> 2019年3月18日月曜日 10時40分16秒 UTC+9 FUJIWARA Katsunori:
Message has been deleted

ohira

unread,
Mar 18, 2019, 2:08:25 AM3/18/19
to mercurial-ja
おおひらです。

藤原さんの回答にありましたとおり20文字のブランチを指定するとエラーを再現できました。
(自分のところでは、ほとんどのブランチが20文字以上なため、たまにしか発生しないでいました)

再現テスト

hg init

hg flow init --default

hg flow feature start 12345678901234567890

hg flow feature/12345678901234567890



結果

[shin@faith] ~/tmp/b20test% hg init
hg flow init --default

hg flow feature start 12345678901234567890
[shin@faith] ~/tmp/b20test%
[shin@faith] ~/tmp/b20test% hg flow init --default
flow: Flow was already initialized for workspace:
flow: Repository-specific configuration:
flow:   <master>  trunk: 'default'
flow:   <develop> trunk: 'develop'
flow:   <feature> branch prefix: 'feature/'
flow:   <release> branch prefix: 'release/'
flow:   <hotfix>  branch prefix: 'hotfix/'
flow:   <support> branch prefix: 'support/'
flow: Global configuration:
flow:   autoshelve: on
[shin@faith] ~/tmp/b20test%
[shin@faith] ~/tmp/b20test% hg flow feature start 12345678901234567890
abort: unknown branch 'develop'!
[shin@faith] ~/tmp/b20test%
[shin@faith] ~/tmp/b20test% hg flow feature/12345678901234567890
flow: error: Stream not found: <feature/12345678901234567890>
[shin@faith] ~/tmp/b20test%


2019年3月18日月曜日 14時48分02秒 UTC+9 ohira:
おおひらです。

hgflow を書き換え、return mercurial.scmutil.revsingle( repo, rev ) に変更しました(debugで入れたprintは削除しました)

PS C:\Users\v530\hgflow\src>
PS C:\Users\v530\hgflow\src> 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.
PS C:\Users\v530\hgflow\src>
PS C:\Users\v530\hgflow\src> hg flow version
flow: warning: Your workspace has uncommitted changes.
flow: version 0.9.8.4
PS C:\Users\v530\hgflow\src> hg diff
diff -r 30c5d6cae041 src/hgflow.py
--- a/src/hgflow.py    Thu Mar 07 23:27:33 2019 -0500
+++ b/src/hgflow.py    Mon Mar 18 14:39:44 2019 +0900
@@ -126,7 +126,8 @@
     try :
         return repo[rev]
     except ((error.ProgrammingError, TypeError) if ("4.7" <= util.version()) else None) :
-        return repo[repo.branchtip( rev )]
+#        return repo[repo.branchtip( rev )]
+        return mercurial.scmutil.revsingle( repo, rev )


 def _clear_bookmarks( repo ) :

PS C:\Users\v530\hgflow\src>



実行結果 コメントで囲むことで hg flow <ブランチ名> が実行できました。
存在しないブランチを指定した場合には、
コメントで囲んでいないと正常に動作しないようです。hg: 解析エラー: can't use a relation in this context

PS C:\Users\v530\repos\trunk\sps_25>
PS 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.
PS C:\Users\v530\repos\trunk\sps_25>
PS C:\Users\v530\repos\trunk\sps_25> hg flow version
flow: version 0.9.8.4
PS C:\Users\v530\repos\trunk\sps_25>
PS C:\Users\v530\repos\trunk\sps_25> hg flow feature/#24057_crypt
flow: error: Stream not found: <feature/#24057_crypt>
PS C:\Users\v530\repos\trunk\sps_25>
PS C:\Users\v530\repos\trunk\sps_25> hg flow feature/#24057_crypt_not_exist
hg: 解析エラー: can't use a relation in this context
PS C:\Users\v530\repos\trunk\sps_25>
PS C:\Users\v530\repos\trunk\sps_25> hg flow "'feature/#24057_crypt'"
flow: Parent of working directory: 29952:d25d531681a3
flow: <'feature/#24057_crypt'> trunk: feature/#24057_crypt
flow: No open <'feature/#24057_crypt'> branches
PS C:\Users\v530\repos\trunk\sps_25>
PS C:\Users\v530\repos\trunk\sps_25> hg flow "'feature/#24057_crypt_not_exist'"
flow: error: Stream not found: <'feature/#24057_crypt_not_exist'>
PS C:\Users\v530\repos\trunk\sps_25>
PS C:\Users\v530\repos\trunk\sps_25>
PS C:\Users\v530\repos\trunk\sps_25>





2019年3月18日月曜日 13時33分10秒 UTC+9 FUJIWARA Katsunori:

ohira

unread,
Mar 18, 2019, 2:14:37 AM3/18/19
to mercurial-ja
テスト結果(やり直しました)

[shin@faith] ~/tmp/b20% hg init
[shin@faith] ~/tmp/b20% hg flow init --default
flow: Global configuration:
flow:   autoshelve: on

marked working directory as branch develop
(branches are permanent and global, did you want a bookmark?)
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
[shin@faith] ~/tmp/b20% hg flow feature start 12345678901234567890
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
marked working directory as branch feature/12345678901234567890
[shin@faith] ~/tmp/b20% hg flow feature/12345678901234567890
flow: Parent of working directory: 2:9d07f8c94dd1
flow: <feature/12345678901234567890> trunk: feature/12345678901234567890
flow: Open <feature/12345678901234567890> branches:
flow:   feature/12345678901234567890*  2:9d07f8c94dd1
[shin@faith] ~/tmp/b20%
[shin@faith] ~/tmp/b20% hg flow feature start 123456789012
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
marked working directory as branch feature/123456789012
abort: unknown revision '666561747572652f313233343536373839303132'!
[shin@faith] ~/tmp/b20% hg flow feature/123456789012
flow: error: Stream not found: <feature/123456789012>
[shin@faith] ~/tmp/b20%
[shin@faith] ~/tmp/b20% hg flow feature/12345678901234567890
flow: Update workspace to <feature/12345678901234567890> trunk.
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
flow: Parent of working directory: 2:9d07f8c94dd1
flow: <feature/12345678901234567890> trunk: feature/12345678901234567890
flow: Open <feature/12345678901234567890> branches:
flow:   feature/12345678901234567890*  2:9d07f8c94dd1
[shin@faith] ~/tmp/b20%

2019年3月18日月曜日 15時08分25秒 UTC+9 ohira:

ohira

unread,
Mar 18, 2019, 2:17:35 AM3/18/19
to mercurial-ja
テストスクリプト
hg init

hg flow init --default

hg flow feature start 123456789012

hg flow feature/123456789012




2019年3月18日月曜日 15時14分37秒 UTC+9 ohira:

ohira

unread,
Mar 18, 2019, 4:12:57 AM3/18/19
to mercurial-ja
おおひらです。

テストスクリプトのプルリクエストを hgflowのリポジトリに送りました。
https://bitbucket.org/yujiewu/hgflow/pull-requests/29/develop/diff

2019年3月18日月曜日 15時17分35秒 UTC+9 ohira:

ohira

unread,
Mar 18, 2019, 8:58:46 PM3/18/19
to mercurial-ja
おおひらです。

ブランチの長さが20のもの他にもあるか調べてみました。

リポジトリ内で現在使用中のブランチが190あり
そのうち2ブランチだけが長さ20で、
hg flow ではエラーになり、
hg update では正常に処理できることが確認できました。

[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 branches | cut -f 1 -d " " | sort | wc -l
     190
[shin@faith] ~/repos/trunk/sps_25%
[shin@faith] ~/repos/trunk/sps_25% hg branches | cut -f 1 -d " " | sort | grep ^....................$
feature/#24057_crypt
feature/delivery_cvs
[shin@faith] ~/repos/trunk/sps_25% hg flow feature/delivery_cvs
flow: error: Stream not found: <feature/delivery_cvs>
[shin@faith] ~/repos/trunk/sps_25%
[shin@faith] ~/repos/trunk/sps_25% hg update feature/delivery_cvs
97 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/#24057_crypt
flow: error: Stream not found: <feature/#24057_crypt>
[shin@faith] ~/repos/trunk/sps_25%
[shin@faith] ~/repos/trunk/sps_25% hg update feature/#24057_crypt
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
[shin@faith] ~/repos/trunk/sps_25%




2019年3月18日月曜日 17時12分57秒 UTC+9 ohira:

ohira

unread,
Mar 19, 2019, 10:24:18 PM3/19/19
to mercurial-ja
おおひらです。
藤原さんからご指摘のあった箇所修正して再度確認しました。

修正内容
[shin@faith] ~/hgflow/src% hg diff
diff -r 8d3678b7f4a0 src/hgflow.py
--- a/src/hgflow.py     Wed Mar 20 11:12:28 2019 +0900
+++ b/src/hgflow.py     Wed Mar 20 11:17:33 2019 +0900
@@ -124,7 +124,7 @@
 def _get_context( repo, rev ) :
     # As of hg v4.7, `repo' will raise `error.ProgrammingError' or `TypeError' when a branch name is passed in as `changeid'.
     try :
-        return repo[rev]
+        return mercurial.scmutil.revsingle( repo, rev )
     except ((error.ProgrammingError, TypeError) if ("4.7" <= util.version()) else None) :
         return repo[repo.branchtip( rev )]

[shin@faith] ~/hgflow/src%


実行結果
[shin@faith] ~/tmp%
[shin@faith] ~/tmp% hg init a
[shin@faith] ~/tmp% cd a
[shin@faith] ~/tmp/a% hg flow init --default
flow: Global configuration:
flow:   autoshelve: on

marked working directory as branch develop
(branches are permanent and global, did you want a bookmark?)
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
[shin@faith] ~/tmp/a%
[shin@faith] ~/tmp/a% hg flow feature start delivery_dhl
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
marked working directory as branch feature/delivery_dhl
[shin@faith] ~/tmp/a%
[shin@faith] ~/tmp/a% hg flow feature/delivery_dhl
flow: Parent of working directory: 2:53e5eca2aaec
hg: parse error at 2: invalid token
( 6B"{5}P r&P
   ^ here)
[shin@faith] ~/tmp/a% env LANG=C hg flow feature/delivery_dhl
flow: Parent of working directory: 2:53e5eca2aaec
hg: parse error at 2: invalid token
( 6B"{5}P r&P
   ^ here)
[shin@faith] ~/tmp/a%



2019年3月19日火曜日 9時58分46秒 UTC+9 ohira:

ohira

unread,
Mar 20, 2019, 12:08:12 AM3/20/19
to mercurial-ja
おおひらです。

hgflow.py を修正して確認するときに mercurial 4.7.2 を使用してたので
最新の mercurial 4.9 でテストしてみました。

テスト結果
[shin@faith] ~/tmp/a%
[shin@faith] ~/tmp/a% hg flow feature start delivery_dhl
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
marked working directory as branch feature/delivery_dhl
abort: unknown revision '666561747572652f64656c69766572795f64686c'!
[shin@faith] ~/tmp/a% hg flow feature/delivery_dhl
flow: error: Stream not found: <feature/delivery_dhl>
[shin@faith] ~/tmp/a%
[shin@faith] ~/tmp/a% hg flow feature/delivery_dhl
flow: Parent of working directory: 3:f9f574944883
hg: parse error at 0: syntax error in revset ' ׉5Bc-c'
( ׉5Bc-c
 ^ here)
[shin@faith] ~/tmp/a% hg flow feature/delivery_kuroneko
flow: Update workspace to <feature/delivery_kuroneko> trunk.
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
flow: Parent of working directory: 2:3d3351ef6e4a
hg: parse error at 0: syntax error in revset ' ׉5Bc-c'
( ׉5Bc-c
 ^ here)
[shin@faith] ~/tmp/a% hg flow
flow: Currently open branches:
hg: parse error at 0: syntax error in revset ' ׉5Bc-c'
( ׉5Bc-c
 ^ here)
[shin@faith] ~/tmp/a%



2019年3月20日水曜日 11時24分18秒 UTC+9 ohira:

Katsunori FUJIWARA

unread,
Mar 20, 2019, 2:30:26 AM3/20/19
to mercurial-ja
藤原です。

_get_context() が呼ばれるケースに関して、私が想定していなかったルー
トからの呼び出しがあるみたいで、repo[rev] を
scmutil.singlerev(repo, rev) で置き換える案はよろしくない感じです。

hgflow の障害報告の方には、以下の修正案の方を提案しようと思っています。

diff --git a/src/hgflow.py b/src/hgflow.py
--- a/src/hgflow.py
+++ b/src/hgflow.py
@@ -125,7 +125,7 @@ def _get_context( repo, rev ) :
# As of hg v4.7, `repo' will raise `error.ProgrammingError'
or `TypeError' when a branch name is passed in as `changeid'.
try :
return repo[rev]
- except ((error.ProgrammingError, TypeError) if ("4.7" <=
util.version()) else None) :
+ except ((error.ProgrammingError, error.RepoLookupError,
TypeError) if ("4.7" <= util.version()) else None) :
return repo[repo.branchtip( rev )]



変更後の動作確認まではできているのですが、Mercurial 側の挙動周り
でもう少し調べたいことがあって、代替案の方の投函はもう少し掛かり
そうです。


2019年3月20日(水) 13:08 ohira <shin....@gmail.com>:

ohira

unread,
Mar 20, 2019, 3:25:34 AM3/20/19
to mercurial-ja
おおひらです。

連絡いただいた変更を、こちらでも試してみました。
正常に処理されるようになったように見えます。

[shin@faith] ~/tmp%
[shin@faith] ~/tmp% hg version
Mercurial Distributed SCM (version 4.9)
(see https://mercurial-scm.org for more information)

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.
[shin@faith] ~/tmp%
[shin@faith] ~/tmp% hg flow version
flow: version 0.9.8.4
[shin@faith] ~/tmp%
[shin@faith] ~/tmp% hg init a
[shin@faith] ~/tmp%
[shin@faith] ~/tmp% cd a
[shin@faith] ~/tmp/a%
[shin@faith] ~/tmp/a% hg flow init --default
flow: Global configuration:
flow:   autoshelve: on

marked working directory as branch develop
(branches are permanent and global, did you want a bookmark?)
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
[shin@faith] ~/tmp/a%
[shin@faith] ~/tmp/a% hg flow feature start delivery_kuroneko
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
marked working directory as branch feature/delivery_kuroneko
[shin@faith] ~/tmp/a%
[shin@faith] ~/tmp/a% hg flow feature/delivery_kuroneko
flow: Parent of working directory: 2:ace7a22459cb
flow: <feature/delivery_kuroneko> trunk: feature/delivery_kuroneko
flow: Open <feature/delivery_kuroneko> branches:
flow:   feature/delivery_kuroneko*  2:ace7a22459cb
[shin@faith] ~/tmp/a%
[shin@faith] ~/tmp/a% hg flow feature start delivery_dhl
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
marked working directory as branch feature/delivery_dhl
[shin@faith] ~/tmp/a%
[shin@faith] ~/tmp/a% hg flow feature/delivery_dhl
flow: Parent of working directory: 3:801dd077e32e
flow: <feature/delivery_dhl> trunk: feature/delivery_dhl
flow: Open <feature/delivery_dhl> branches:
flow:   feature/delivery_dhl*  3:801dd077e32e
[shin@faith] ~/tmp/a%
[shin@faith] ~/tmp/a% hg update feature/delivery_dhl
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
[shin@faith] ~/tmp/a%



2019年3月20日水曜日 15時30分26秒 UTC+9 FUJIWARA Katsunori:

ohira

unread,
Mar 20, 2019, 3:49:53 AM3/20/19
to mercurial-ja
[shin@faith] ~/hgflow/src% hg diff
diff -r 8d3678b7f4a0 src/hgflow.py
--- a/src/hgflow.py     Wed Mar 20 11:12:28 2019 +0900
+++ b/src/hgflow.py     Wed Mar 20 16:17:01 2019 +0900
@@ -125,7 +125,7 @@
     # As of hg v4.7, `repo' will raise `error.ProgrammingError' or `TypeError' when a branch name is passed in as `changeid'.
     try :
         return repo[rev]
-    except ((error.ProgrammingError, TypeError) if ("4.7" <= util.version()) else None) :
+    except ((error.ProgrammingError, error.RepoLookupError, TypeError) if ("4.7" <= util.version()) else None) :
         return repo[repo.branchtip( rev )]


[shin@faith] ~/hgflow/src%



2019年3月20日水曜日 16時25分34秒 UTC+9 ohira:
Reply all
Reply to author
Forward
Message has been deleted
0 new messages