Patchwork [10,of,14] merge: drop reference to file contents immediately after write

login
register
mail settings
Submitter Mads Kiilerich
Date Jan. 13, 2013, 7:02 p.m.
Message ID <583e0caedba3ec1fece6.1358103765@localhost6.localdomain6>
Download mbox | patch
Permalink /patch/585/
State Superseded
Commit 26627c30735a610f59979a36885b327b25d8dbff
Headers show

Comments

Mads Kiilerich - Jan. 13, 2013, 7:02 p.m.
# HG changeset patch
# User Mads Kiilerich <mads@kiilerich.com>
# Date 1357775151 -3600
# Node ID 583e0caedba3ec1fece6ec7afc0a2e44082d984e
# Parent  4059319bd1d4a9145c5f2b159e5d909f64bdf54c
merge: drop reference to file contents immediately after write

Like 7d2aaeea67ed this reduces memory usage on large merges.

Patch

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -405,9 +405,7 @@  def applyupdates(repo, actions, wctx, mc
         elif m == "g": # get
             flags = a[2]
             repo.ui.note(_("getting %s\n") % f)
-            t = mctx.filectx(f).data()
-            repo.wwrite(f, t, flags)
-            t = None
+            repo.wwrite(f, mctx.filectx(f).data(), flags)
             updated += 1
             if f == '.hgsubstate': # subrepo states need updating
                 subrepo.submerge(repo, wctx, mctx, wctx, overwrite)
@@ -416,13 +414,11 @@  def applyupdates(repo, actions, wctx, mc
             if f:
                 repo.ui.note(_("moving %s to %s\n") % (f, fd))
                 audit(f)
-                t = wctx.filectx(f).data()
-                repo.wwrite(fd, t, flags)
+                repo.wwrite(fd, wctx.filectx(f).data(), flags)
                 util.unlinkpath(repo.wjoin(f))
             if f2:
                 repo.ui.note(_("getting %s to %s\n") % (f2, fd))
-                t = mctx.filectx(f2).data()
-                repo.wwrite(fd, t, flags)
+                repo.wwrite(fd, mctx.filectx(f2).data(), flags)
             updated += 1
         elif m == "dr": # divergent renames
             fl = a[2]