##// END OF EJS Templates
commit: pass mergestate into _filecommit() instead of re-reading it...
Pulkit Goyal -
r46014:037e88d4 default
parent child Browse files
Show More
@@ -157,6 +157,7 b' def _process_files(tr, ctx, error=False)'
157 m = mctx.read()
157 m = mctx.read()
158 m1 = m1ctx.read()
158 m1 = m1ctx.read()
159 m2 = m2ctx.read()
159 m2 = m2ctx.read()
160 ms = mergestate.mergestate.read(repo)
160
161
161 files = metadata.ChangingFiles()
162 files = metadata.ChangingFiles()
162
163
@@ -175,7 +176,7 b' def _process_files(tr, ctx, error=False)'
175 else:
176 else:
176 added.append(f)
177 added.append(f)
177 m[f], is_touched = _filecommit(
178 m[f], is_touched = _filecommit(
178 repo, fctx, m1, m2, linkrev, tr, writefilecopymeta,
179 repo, fctx, m1, m2, linkrev, tr, writefilecopymeta, ms
179 )
180 )
180 if is_touched:
181 if is_touched:
181 if is_touched == 'added':
182 if is_touched == 'added':
@@ -211,7 +212,7 b' def _process_files(tr, ctx, error=False)'
211
212
212
213
213 def _filecommit(
214 def _filecommit(
214 repo, fctx, manifest1, manifest2, linkrev, tr, includecopymeta,
215 repo, fctx, manifest1, manifest2, linkrev, tr, includecopymeta, ms,
215 ):
216 ):
216 """
217 """
217 commit an individual file as part of a larger transaction
218 commit an individual file as part of a larger transaction
@@ -226,6 +227,7 b' def _filecommit('
226 includecopymeta: boolean, set to False to skip storing the copy data
227 includecopymeta: boolean, set to False to skip storing the copy data
227 (only used by the Google specific feature of using
228 (only used by the Google specific feature of using
228 changeset extra as copy source of truth).
229 changeset extra as copy source of truth).
230 ms: mergestate object
229
231
230 output: (filenode, touched)
232 output: (filenode, touched)
231
233
@@ -324,8 +326,10 b' def _filecommit('
324 fparent2 = nullid
326 fparent2 = nullid
325 elif not fparentancestors:
327 elif not fparentancestors:
326 # TODO: this whole if-else might be simplified much more
328 # TODO: this whole if-else might be simplified much more
327 ms = mergestate.mergestate.read(repo)
329 if (
328 if ms.extras(fname).get(b'filenode-source') == b'other':
330 ms.active()
331 and ms.extras(fname).get(b'filenode-source') == b'other'
332 ):
329 fparent1, fparent2 = fparent2, nullid
333 fparent1, fparent2 = fparent2, nullid
330
334
331 # is the file changed?
335 # is the file changed?
@@ -481,7 +481,7 b' and its ancestor by overriding "repo._fi'
481 > from __future__ import absolute_import
481 > from __future__ import absolute_import
482 > from mercurial import commit, error, extensions, node
482 > from mercurial import commit, error, extensions, node
483 > def _filecommit(orig, repo, fctx, manifest1, manifest2,
483 > def _filecommit(orig, repo, fctx, manifest1, manifest2,
484 > linkrev, tr, includecopymeta):
484 > linkrev, tr, includecopymeta, ms):
485 > fname = fctx.path()
485 > fname = fctx.path()
486 > text = fctx.data()
486 > text = fctx.data()
487 > flog = repo.file(fname)
487 > flog = repo.file(fname)
@@ -484,7 +484,7 b' and its ancestor by overriding "repo._fi'
484 > from __future__ import absolute_import
484 > from __future__ import absolute_import
485 > from mercurial import commit, error, extensions, node
485 > from mercurial import commit, error, extensions, node
486 > def _filecommit(orig, repo, fctx, manifest1, manifest2,
486 > def _filecommit(orig, repo, fctx, manifest1, manifest2,
487 > linkrev, tr, includecopymeta):
487 > linkrev, tr, includecopymeta, ms):
488 > fname = fctx.path()
488 > fname = fctx.path()
489 > text = fctx.data()
489 > text = fctx.data()
490 > flog = repo.file(fname)
490 > flog = repo.file(fname)
General Comments 0
You need to be logged in to leave comments. Login now