简体   繁体   English

Mercurial-hg命令行列出特定版本的所有文件

[英]Mercurial - hg command line to list all files from a specific rev

I'm a new mercurial user, and i 've got a specific needs on my project. 我是一个新的商业用户,我对我的项目有特定的需求。

I would like to know if there's an easy way to list every files from a project rev and for each file, get the reversion version. 我想知道是否有一种简便的方法可以列出项目版本中的每个文件,并为每个文件获取版本。

For example : 例如 :

rev 100
-toto.c rev 3
-toto.h rev 50
-tata.c rev 100

Thanks in advance if someone got an idea :) 在此先感谢您是否有想法:)

A file in Hg doesn't have a specific revision number associated with it ("the most recent revision in which this file was changed") A single file can have multiple "most recent versions" in different branches. Hg中的文件没有与之关联的特定修订版本号(“此文件的最新修订版本”)。单个文件可以在不同分支中具有多个“最新版本”。

This command lists all files in a certain revision: 此命令列出特定修订版中的所有文件:

hg Manifest hg清单

hg manifest [-r REV] 汞清单[-r REV]

output the current or given revision of the project manifest 输出项目清单的当前版本或给定版本

manifest and log was the two commands i used in my batchfile but i have to do some test because following my understanding there is a probleme : manifest和log是我在批处理文件中使用的两个命令,但是我必须做一些测试,因为按照我的理解,这是一个问题:

The rev is 10, into this rev there is a file test.c which has been changed in rev 5 and 10. If i apply manifest and log commands on it i will have test.c in my files list and the rev of test.c will be 10. The problem is, if i understand good enough, when i will ask the manifest for rev5, i will also have test.c in my list of files but when i will apply a log on it it will give me only the latest version of that file ... so rev10. 修订版是10,在该修订版中有一个文件test.c,在修订版5和10中已对其进行了更改。如果我对其应用清单和日志命令,我的文件列表和测试修订版中将包含test.c。 c将是10。问题是,如果我理解得足够好,当我向清单索要rev5时,我还将在文件列表中包含test.c,但是当我在其上应用日志时,它只会给我该文件的最新版本。因此是rev10。 Even if in rev 5 my file has an oldest version ... I will take some time today to do some test :) 即使在第5版中,我的文件具有最旧的版本,我今天还是需要一些时间进行测试:)

Thanks for your advices 感谢您的建议

You could combine manifest and log to obtain your stated list: 您可以结合清单和日志来获得您声明的列表:

for i in `hg ma`; do hg log -l1 $i --template="$i: {rev}\n"; done

It will list the latest change to each file found in the currently checked out revision. 它将列出当前签出的修订中找到的每个文件的最新更改。 If you want all files ever found in the repository (even when they are not there anymore) you could give the --all flag for manifest. 如果要在存储库中找到所有文件(即使不再存在),则可以为清单指定--all标志。 And maybe add --follow and --removed to log. 也许添加--follow和--removed以记录日志。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM