简体   繁体   English

我如何检查HG Pull中哪些文件和哪些内容已更改

[英]How can i check which files and what content have changed in hg pull

I was on default branch. 我在默认分支上。

Then i used hg pull -u 然后我用了hg pull -u

Then i get this 然后我得到这个

searching for changes
adding changesets
adding manifests
adding file changes
added 3 changesets with 3 changes to 1 files
1 files updated, 0 files merged, 0 files removed, 0 files unresolved

Now i want to know what files were updated and what contents were updated in that filew hich was updated 现在我想知道该文件中更新了哪些文件以及更新了哪些内容

This is why it's better to use hg pull not hg pull -u . 这就是为什么最好使用hg pull而不是hg pull -u If you used the preferred hg pull Your session would look like this: 如果您使用首选的hg pull您的会话将如下所示:

$ hg pull
searching for changes
adding changesets
adding manifests
adding file changes
added 3 changesets with 3 changes to 1 files

$ hg diff default  # this shows you exactly what you want to see

$ hg update
1 files updated, 0 files merged, 0 files removed, 0 files unresolved

The key there is that if you pull (the new changesets into your repository) but don't update the files in your working directory you can then hg diff default which compares your current working directory's files (aka what you had before the pull) and the new head of default after the pull. 关键在于,如果您将(新的变更集放入存储库中)拉出但不更新工作目录中的文件,则可以使用hg diff default来比较当前工作目录的文件(又称拉之前的文件),然后拉后的默认新头。 If you like the changes then you apply them to your local files with hg update . 如果您喜欢这些更改,则可以通过hg update将它们应用于本地文件。

That said, in this specific case since you know you got 3 changesets, and since they're probably linear you can do: 就是说,在这种特定情况下,因为您知道有3个变更集,并且由于它们可能是线性的,所以可以执行以下操作:

hg diff --rev -4

which says compare my current revision (now the head since you updated) with the revision 3 back (-1 is the last). 这表示将我当前的修订版(现在是您更新后的标题)与修订版3进行比较(-1是最后一个)。 But break the -u habit. 但是要打破-u习惯。 Updating your repository and your working directory are entirely different actions and better done separately. 更新存储库和工作目录是完全不同的操作,最好分别进行。

hg incoming will let you check for new changesets that will be pulled when you do a hg pull (with or without the update option). 进行hg pull (带有或不带有update选项)时, hg incoming将允许您检查将被拉动的新变更集。 I typically do this through TortoiseHG and it lets me sanity check what will come in before I actually bring the changes into my local repository let alone update to that changeset. 我通常通过TortoiseHG进行此操作,它可以让我理智地检查将要带入的内容,然后再将更改真正带入本地存储库,更不用说更新该更改集了。

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

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