Bug 374898

Summary: Missing command line flag "-u" for the pull command.
Product: [Developer tools] kdevplatform Reporter: Frank Fischer <frank-fischer>
Component: mercurialAssignee: kdevelop-bugs-null
Status: RESOLVED INTENTIONAL    
Severity: normal CC: frank-fischer, kalinichev.so.0
Priority: NOR    
Version First Reported In: git master   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Frank Fischer 2017-01-11 07:57:31 UTC
The git plugin uses the command "git pull" for implementing the pull method. This command gets new revisions from remote and updates the working tree accordingly. In contrast, mercurial's "hg pull" merely fetches remote changes without updating the working tree. Updating the working tree can be done by adding the "-u" flag to the pull command. (However, I'm not sure whether the ::pull method is supposed to update the working tree, but I think so).

Actually, "git pull" means "git fetch" plus "git merge FETCH_HEAD", so maybe it's even better to use "hg fetch", but this is marked as deprecated.
Comment 1 Frank Fischer 2017-01-12 09:46:20 UTC
I'm not sure about this anymore. Apparently, git updates only files on pull that do not have any conflicts. Mercurial's pull -u, however, would force a merge (possibly leaving conflict markers in the file).

According to the documentation of IDistributedVersionControl::pull, it should only get changes but do not merge them into the working tree. This is what mercurial's pull without -u would do.

The difference to git is:
- if there are no conflicts, "git pull" will move HEAD to the newly pulled change, "hg pull" will just get the changes but does not update working tree
- if there are conflicts, "git pull" will just fail, leaving HEAD at its old position

In my opinion (and according to the documentation of IDistributedVersionControl::pull), the plain "hg pull" (without -u) is the correct thing to do, and the implementation for "git pull" should rather be "git fetch" (but does this make sense because one would have to use FETCH_HEAD to refer to the newly pulled changes?). 

I'm not sure here, maybe the difference is just fine and necessary because of the differences between git and hg.
Comment 2 Sergey Kalinichev 2017-01-17 15:48:44 UTC
I'm not sure what we should do here either. Let's keep it as is then?