开发者

It it possible to update specific directory to old revision in Mercurial?

开发者 https://www.devze.com 2023-04-05 11:09 出处:网络
I tried to update some开发者_高级运维 files to old revision in many ways, but I haven\'t found yet.

I tried to update some开发者_高级运维 files to old revision in many ways, but I haven't found yet. (not permanently, just temporarily updating for testing)

For example, the following is OK in SVN.

svn up -r 100 foo.cpp
U    foo.cpp

But in Mercurial, 'up' command doesn't permit file name argument.

Only is it possible to update entire source tree in Mercurial?


You'd have to use hg revert:

hg revert -r 100 foo.cpp

Note that this gives you local changes, as can be seen by running hg diff.

See hg help revert for more info.


This is fundamentally disallowed by Mercurial and other DVCSs. Both CVS and Subversion track which revision you have checked out on a per-file basis. You could have r1 of file x and r2 of file y. In a DVCs the entire repository is at a single version, which in Mercurial you can see with hg id.

As @Tom points out you can have modified files from different revisions, but if you want to see another revision without changes showing up you need to do the update in another clone (which given that local clones use hard links to be (a) instant and (b) space efficient) that's not much of a hassle.

0

精彩评论

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

关注公众号