开发者

Why does Mercurial not authenticate before pushing data?

I have a big size clone to push to Google Code, and it takes a long time for the authenticate dialog to s开发者_如何学Gohow up after the push is fired up, so does TortoiseHg push data first authenticate second?


Update: The bug is now fixed.

Edit by durin42: It's not entirely fixed. We're close, but there's still some work for me to do before the rewrite is on-by-default. We're trying to be really conservative with the switchover. (Accurate status as of January 2012, watch release notes for Mercurial for further updates.)


TL;DR: httplib is essentially broken here, and that causes this problem hg. People are working on fixing this.

This is an unfortunate side effect of the way urllib and httplib work. httplib/urllib won't preemptively send authorization, which is unfortunate.

The good news is that there's ongoing work to fix this, the bad news is that it looks like it'll take essentially a complete rewrite of httplib to get it to reasonable behavior. In particular, httplib is half-duplex, and has no way to peek at incoming packets (to detect an early response), so it has to send a request first before it can get a digest auth prompt (assuming use of digest auth, which is the best option). Some server implementations even close the socket once they send out a 401 Authorization Required, which actually breaks httplib completely by raising a broken pipe error. I submitted a workaround for that problem which is in hg 1.4, but it's only a user-annoyance fix, not an actual performance solution.


I expect it will be gathering a list of changesets from the server so it knows which local changesets do not appear on the server, and thus need to be transferred. Basically the equivalent of hg outgoing. Only once it has determined the changesets to push does it need to write anything (and potentially not, if there are no differences) so it won't authenticate until it actually needs to.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜