Mercurial: How do I know the difference between my working copy and another copy

I am new to Mercurial and mainly worked on Clearcase.

Before making changes from the last branch, I would like to know the changes that exist and which files have conflicts. (Basically, to see if I need to do the update now or later.)

Is there a way to make hg diff between a working copy and another?

+4
source share
4 answers

You can check what changes are in another repository using:

hg incoming path 

This is basically like pull , but actually it is not pulling.

But in fact, you can usually just pull because pulling out the incoming change sets does not concern your working copy. Only when you update or merge update your working copy, at the risk of running into conflicts.

Ideally, for update and merge there is an option for a trial merge, that is, it will merge if there is no conflict, but such an option does not currently exist.

Once the changes are pulled into your repository, you can use diff to compare it with your working copy, as usual.

 hg diff -r tip 
+7
source

Is there a way to make hg diff between a working copy and another?

No. diff compares two versions from a repo . In your case, you can blindly pull out (get updatesto repo), but avoid automatic updates | merge your working copy. With a synchronized repo, you can use hg diff, hg update, hg merge manually when and if necessary. You can also do nothing and make your changes - you will only have an anonymous branch and an additional head in the repo

+2
source

First, you must make your changes before you do anything. I have never worked with ClearCase, but I think it should work like SVN, forgive me if I am wrong. One of the biggest advantages of DVCS over CVCS is that it allows you to complete the first and decide what to do later. This is very important, because first you consolidate your work, if as a result everything becomes too messy during the merger, your work will be safe in the repository. At the worst price, you can even give up a promiscuous merger and start over. And even after the merger, the version of your original work (before the merger) will be there, it is very important to check whether this merger caused any problem. In SVN (and assuming ClearCase is similar), it's the other way around: it does not allow committing without updating and merging ... I hate it!

Another thing is the pull command in mercurial does not change anything in the working directory. It just makes changes to the local repository. So, in my presentation you should:

  • Fix
  • Pull, nothing will happen to the working copy.
  • Now you can check the journal, compare changes and decide what and how to do without risking losing your job. If you decide that you are not going to merge now, that’s fine, you don’t need to combine things just because you pulled out other versions (although the recommended practice is to merge often to avoid headaches replacing very different versions).
+1
source

If you use TortoiseHG, you can use the inbound button, which loads the incoming changes, but gives you the option to apply them or not.

See here .

0
source

Source: https://habr.com/ru/post/1379771/


All Articles