问题
In Git SCM I'm using the following command to check whether a specific revision is present on some remote:
git fetch <remote> <revision> -q --dry-run
If the exit code of the command is zero that means the revision is present on the remote.
For Mercurial I tried the following command:
hg pull <remote> -r <revision> -q
It works but the problem is that it actually pulls the revision if present on the remote, but not locally. Is there an equivalent of the --dry-run
option for Git, or some other way to do it in Mercurial which does not perform pulling of the specified revision, but only checks whether it is present on the remote?
回答1:
hg in -r REV
-r --rev REV [+] a remote changeset intended to be added
Returns 0 if there are incoming changes, 1 otherwise.
来源:https://stackoverflow.com/questions/64430285/how-to-check-whether-specific-revision-is-present-on-some-mercurial-remote