Show More
@@ -9,7 +9,7 b' import errno' | |||
|
9 | 9 | from node import nullid |
|
10 | 10 | from i18n import _ |
|
11 | 11 | import scmutil, util, ignore, osutil, parsers, encoding |
|
12 | import os, stat, errno | |
|
12 | import os, stat, errno, gc | |
|
13 | 13 | |
|
14 | 14 | propertycache = util.propertycache |
|
15 | 15 | filecache = scmutil.filecache |
@@ -285,7 +285,23 b' class dirstate(object):' | |||
|
285 | 285 | if not st: |
|
286 | 286 | return |
|
287 | 287 | |
|
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: | |
|
288 | 301 | p = parsers.parse_dirstate(self._map, self._copymap, st) |
|
302 | finally: | |
|
303 | if gcenabled: | |
|
304 | gc.enable() | |
|
289 | 305 | if not self._dirtypl: |
|
290 | 306 | self._pl = p |
|
291 | 307 |
@@ -196,6 +196,7 b' def manifestmerge(repo, wctx, p2, pa, br' | |||
|
196 | 196 | overwrite = force and not branchmerge |
|
197 | 197 | actions, copy, movewithdir = [], {}, {} |
|
198 | 198 | |
|
199 | followcopies = False | |
|
199 | 200 | if overwrite: |
|
200 | 201 | pa = wctx |
|
201 | 202 | elif pa == p2: # backwards |
@@ -203,6 +204,13 b' def manifestmerge(repo, wctx, p2, pa, br' | |||
|
203 | 204 | elif not branchmerge and not wctx.dirty(missing=True): |
|
204 | 205 | pass |
|
205 | 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 | 214 | ret = copies.mergecopies(repo, wctx, p2, pa) |
|
207 | 215 | copy, movewithdir, diverge, renamedelete = ret |
|
208 | 216 | for of, fl in diverge.iteritems(): |
@@ -515,12 +523,12 b' def calculateupdates(repo, tctx, mctx, a' | |||
|
515 | 523 | _checkcollision(mctx, None) |
|
516 | 524 | else: |
|
517 | 525 | _checkcollision(mctx, (tctx, ancestor)) |
|
518 | if tctx.rev() is None: | |
|
519 | actions += _forgetremoved(tctx, mctx, branchmerge) | |
|
520 | 526 | actions += manifestmerge(repo, tctx, mctx, |
|
521 | 527 | ancestor, |
|
522 | 528 | branchmerge, force, |
|
523 | 529 | partial) |
|
530 | if tctx.rev() is None: | |
|
531 | actions += _forgetremoved(tctx, mctx, branchmerge) | |
|
524 | 532 | return actions |
|
525 | 533 | |
|
526 | 534 | def recordupdates(repo, actions, branchmerge): |
General Comments 0
You need to be logged in to leave comments.
Login now