Show More
@@ -9,7 +9,7 b' import errno' | |||||
9 | from node import nullid |
|
9 | from node import nullid | |
10 | from i18n import _ |
|
10 | from i18n import _ | |
11 | import scmutil, util, ignore, osutil, parsers, encoding |
|
11 | import scmutil, util, ignore, osutil, parsers, encoding | |
12 | import os, stat, errno |
|
12 | import os, stat, errno, gc | |
13 |
|
13 | |||
14 | propertycache = util.propertycache |
|
14 | propertycache = util.propertycache | |
15 | filecache = scmutil.filecache |
|
15 | filecache = scmutil.filecache | |
@@ -285,7 +285,23 b' class dirstate(object):' | |||||
285 | if not st: |
|
285 | if not st: | |
286 | return |
|
286 | return | |
287 |
|
287 | |||
288 | p = parsers.parse_dirstate(self._map, self._copymap, st) |
|
288 | # Python's garbage collector triggers a GC each time a certain number | |
|
289 | # of container objects (the number being defined by | |||
|
290 | # gc.get_threshold()) are allocated. parse_dirstate creates a tuple | |||
|
291 | # for each file in the dirstate. The C version then immediately marks | |||
|
292 | # them as not to be tracked by the collector. However, this has no | |||
|
293 | # effect on when GCs are triggered, only on what objects the GC looks | |||
|
294 | # into. This means that O(number of files) GCs are unavoidable. | |||
|
295 | # Depending on when in the process's lifetime the dirstate is parsed, | |||
|
296 | # this can get very expensive. As a workaround, disable GC while | |||
|
297 | # parsing the dirstate. | |||
|
298 | gcenabled = gc.isenabled() | |||
|
299 | gc.disable() | |||
|
300 | try: | |||
|
301 | p = parsers.parse_dirstate(self._map, self._copymap, st) | |||
|
302 | finally: | |||
|
303 | if gcenabled: | |||
|
304 | gc.enable() | |||
289 | if not self._dirtypl: |
|
305 | if not self._dirtypl: | |
290 | self._pl = p |
|
306 | self._pl = p | |
291 |
|
307 |
@@ -196,6 +196,7 b' def manifestmerge(repo, wctx, p2, pa, br' | |||||
196 | overwrite = force and not branchmerge |
|
196 | overwrite = force and not branchmerge | |
197 | actions, copy, movewithdir = [], {}, {} |
|
197 | actions, copy, movewithdir = [], {}, {} | |
198 |
|
198 | |||
|
199 | followcopies = False | |||
199 | if overwrite: |
|
200 | if overwrite: | |
200 | pa = wctx |
|
201 | pa = wctx | |
201 | elif pa == p2: # backwards |
|
202 | elif pa == p2: # backwards | |
@@ -203,6 +204,13 b' def manifestmerge(repo, wctx, p2, pa, br' | |||||
203 | elif not branchmerge and not wctx.dirty(missing=True): |
|
204 | elif not branchmerge and not wctx.dirty(missing=True): | |
204 | pass |
|
205 | pass | |
205 | elif pa and repo.ui.configbool("merge", "followcopies", True): |
|
206 | elif pa and repo.ui.configbool("merge", "followcopies", True): | |
|
207 | followcopies = True | |||
|
208 | ||||
|
209 | # manifests fetched in order are going to be faster, so prime the caches | |||
|
210 | [x.manifest() for x in | |||
|
211 | sorted(wctx.parents() + [p2, pa], key=lambda x: x.rev())] | |||
|
212 | ||||
|
213 | if followcopies: | |||
206 | ret = copies.mergecopies(repo, wctx, p2, pa) |
|
214 | ret = copies.mergecopies(repo, wctx, p2, pa) | |
207 | copy, movewithdir, diverge, renamedelete = ret |
|
215 | copy, movewithdir, diverge, renamedelete = ret | |
208 | for of, fl in diverge.iteritems(): |
|
216 | for of, fl in diverge.iteritems(): | |
@@ -515,12 +523,12 b' def calculateupdates(repo, tctx, mctx, a' | |||||
515 | _checkcollision(mctx, None) |
|
523 | _checkcollision(mctx, None) | |
516 | else: |
|
524 | else: | |
517 | _checkcollision(mctx, (tctx, ancestor)) |
|
525 | _checkcollision(mctx, (tctx, ancestor)) | |
518 | if tctx.rev() is None: |
|
|||
519 | actions += _forgetremoved(tctx, mctx, branchmerge) |
|
|||
520 | actions += manifestmerge(repo, tctx, mctx, |
|
526 | actions += manifestmerge(repo, tctx, mctx, | |
521 | ancestor, |
|
527 | ancestor, | |
522 | branchmerge, force, |
|
528 | branchmerge, force, | |
523 | partial) |
|
529 | partial) | |
|
530 | if tctx.rev() is None: | |||
|
531 | actions += _forgetremoved(tctx, mctx, branchmerge) | |||
524 | return actions |
|
532 | return actions | |
525 |
|
533 | |||
526 | def recordupdates(repo, actions, branchmerge): |
|
534 | def recordupdates(repo, actions, branchmerge): |
General Comments 0
You need to be logged in to leave comments.
Login now