Mercurial - 变更集中更改的所有文件?
如何确定给定变更集中发生更改的所有文件?
在这种情况下,我不是在寻找差异,只是在寻找添加/删除/修改的列表。
hg log -vprX
列出了差异列表,但我只想要文件。
How can you determine all the files that changed in a given changeset?
I'm not looking for a diff in this case, just a list of add/remove/modifications.
hg log -vprX
does a list of diffs but I just want the files.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
如果您只想列出已更改的文件,那么您应该使用“状态命令”
下面将列出修订版 REV 中文件的更改
If you want to list only files that have changed then you should be using "status command"
The following will list the changes to files in revision REV
当前提交的修订
.
是当前修订版的简写,就像 Git当前未提交的修订
任意提交的修订中的
@HEAD
一样Current Committed Revision
.
is shorthand for the current rev, just like@HEAD
in GitCurrent Uncommitted Revision
Arbitrary Committed Revision
只需从
hg log -vpr
中删除p
即可显示文件列表。-p
表示显示补丁。您还可以使用模板来格式化输出到你的口味。Just remove
p
from yourhg log -vpr
will show the list of files.-p
means show patch. You can also use a template to format the output to your taste.我知道问题是针对单个变更集,但如果您想针对一系列变更集修改所有文件,您可以这样做
I know the question is for a single changeset, but if you'd like to get all the files modified for a range of changesets, you can do
通过谷歌搜索类似的概念找到了这个问题。要显示通过范围变更集进行更改的所有文件,只需:
hg log -r [start rev]:[end rev] --template "{file_mods}{file_adds} \n"
将显示每个变更集中更改或添加的每个文件的列表,从 [start rev] 到 [end rev],每个变更集的文件位于新行。将{file_mods}{file_adds}
与{files}
交换以显示所有修改、添加或删除的文件。sed -e 's/ /\n/g'
将拆分所有文件以在单独的行上显示,并且sort
将为您对列表进行排序,以便我们可以使用 uniq 过滤列表uniq
将过滤列表以删除重复项 - 在多个修订版中更改的文件。Found this question through Googling for a similar concept. To show all files that changed through a range of changesets, it's as easy as:
hg log -r [start rev]:[end rev] --template "{file_mods}{file_adds}\n"
will show you a list of each file changed or added in each changeset, from [start rev] to [end rev], with each changeset's files on a new line. Swap{file_mods}{file_adds}
with{files}
to show all files modified, added, or removed.sed -e 's/ /\n/g'
will split all the files to show on separate lines andsort
will, er, sort the list for you so we can filter the list with uniquniq
will filter the list to remove duplicates—files that changed in more than one revision.我知道这个问题是一个老问题,我很惊讶没有人提供修改后的代码表格 OP。我通过运行 hg log -v 获得了修改/添加/删除文件的列表(虽然没有标记哪个是哪个)。或者我实际上需要 hg log -v -l5 来查看最近 5 次提交中已修改/添加/删除的文件(包括我尚未推送到存储库的文件)。
I know this question is an old question and I'm surprised nobody just offered modified code form OP. I got a list of modified/added/removed files (not labeled which is which though) by just running
hg log -v
. Or what I actually neededhg log -v -l5
to see files that have been modified/added/removed in the last 5 commits (including the ones that I didn't push yet to the repo).如果您像大多数商店一样,可以使用票务系统来跟踪更改。如果您知道票证编号并希望查找与该票证关联的所有提交(假设您在提交消息中包含票证编号),则可以使用:
这确实显示与该票证关联的所有修订。但是,它没有列出文件。您可以使用上面的答案之一来获取与修订相关的文件列表。
为了使其更简单,结合之前答案中的信息,您可以执行以下操作来搜索提交,包括更改的文件:
If you're like most shops, you use a ticketing system to track changes. If you know the ticket number and want to find all the commits associated with that ticket (assuming you include the ticket number in the commit message), you can use:
This does display the all the revisions associated with the ticket. However, it does not list the files. You could do use one of the answers above to then get the list of files associated with the revisions.
To make it simpler though, combining the info from the previous answers, you could do the following to search for commits, including files changed: