Mercurial > hg
comparison mercurial/merge.py @ 19929:ab2362e1672e
merge: exit early during a no-op update (BC)
hg update . (or equivalents) are effectively no-ops in just about all
circumstances. These sorts of updates can be especially common in a
bookmark-oriented workflow. This saves us a status check and a manifest
decompression, which means that on a repo with over 210,000 files, this brings
hg update . down from 2.5 seconds to 0.15.
There is one change in behavior: a file that was added, not committed, and then
deleted but not removed used to be removed from the dirstate. With this patch
it isn't. This is what causes the change in test-mq-qpush-exact.t. This seems
like it's enough of an edge case to not be worth handling.
The output of test-empty.t changes because those files are not yet created.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Tue, 01 Oct 2013 17:43:54 -0700 |
parents | 0f64af33fb63 |
children | d51c4d85ec23 |
comparison
equal
deleted
inserted
replaced
19928:d1ac3790e10a | 19929:ab2362e1672e |
---|---|
717 if wc.sub(s).dirty(): | 717 if wc.sub(s).dirty(): |
718 raise util.Abort(_("uncommitted changes in " | 718 raise util.Abort(_("uncommitted changes in " |
719 "subrepository '%s'") % s) | 719 "subrepository '%s'") % s) |
720 | 720 |
721 elif not overwrite: | 721 elif not overwrite: |
722 if p1 == p2: # no-op update | |
723 # call the hooks and exit early | |
724 repo.hook('preupdate', throw=True, parent1=xp2, parent2='') | |
725 repo.hook('update', parent1=xp2, parent2='', error=0) | |
726 return 0, 0, 0, 0 | |
727 | |
722 if pa not in (p1, p2): # nolinear | 728 if pa not in (p1, p2): # nolinear |
723 dirty = wc.dirty(missing=True) | 729 dirty = wc.dirty(missing=True) |
724 if dirty or onode is None: | 730 if dirty or onode is None: |
725 # Branching is a bit strange to ensure we do the minimal | 731 # Branching is a bit strange to ensure we do the minimal |
726 # amount of call to obsolete.background. | 732 # amount of call to obsolete.background. |