Mercurial > hg
annotate mercurial/commit.py @ 45231:f0d4d1343cb4
commitctx: extract the function that commit a new manifest
The logic is large enough and isolated enough to be extracted, this reduce the
size of the main function, making it simpler to follow.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Thu, 23 Jul 2020 14:58:21 +0200 |
parents | 5d0998ccedbb |
children | 4eb6466e6889 |
rev | line source |
---|---|
45203
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
1 # commit.py - fonction to perform commit |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
2 # |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
3 # This software may be used and distributed according to the terms of the |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
4 # GNU General Public License version 2 or any later version. |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
5 |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
6 from __future__ import absolute_import |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
7 |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
8 import errno |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
9 |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
10 from .i18n import _ |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
11 from .node import ( |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
12 hex, |
45204
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
13 nullid, |
45203
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
14 nullrev, |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
15 ) |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
16 |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
17 from . import ( |
45204
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
18 context, |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
19 mergestate, |
45203
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
20 metadata, |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
21 phases, |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
22 scmutil, |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
23 subrepoutil, |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
24 ) |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
25 |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
26 |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
27 def commitctx(repo, ctx, error=False, origctx=None): |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
28 """Add a new revision to the target repository. |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
29 Revision information is passed via the context argument. |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
30 |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
31 ctx.files() should list all files involved in this commit, i.e. |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
32 modified/added/removed files. On merge, it may be wider than the |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
33 ctx.files() to be committed, since any file nodes derived directly |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
34 from p1 or p2 are excluded from the committed ctx.files(). |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
35 |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
36 origctx is for convert to work around the problem that bug |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
37 fixes to the files list in changesets change hashes. For |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
38 convert to be the identity, it can pass an origctx and this |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
39 function will use the same files list when it makes sense to |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
40 do so. |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
41 """ |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
42 repo = repo.unfiltered() |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
43 |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
44 p1, p2 = ctx.p1(), ctx.p2() |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
45 user = ctx.user() |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
46 |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
47 if repo.filecopiesmode == b'changeset-sidedata': |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
48 writechangesetcopy = True |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
49 writefilecopymeta = True |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
50 writecopiesto = None |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
51 else: |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
52 writecopiesto = repo.ui.config(b'experimental', b'copies.write-to') |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
53 writefilecopymeta = writecopiesto != b'changeset-only' |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
54 writechangesetcopy = writecopiesto in ( |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
55 b'changeset-only', |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
56 b'compatibility', |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
57 ) |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
58 p1copies, p2copies = None, None |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
59 if writechangesetcopy: |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
60 p1copies = ctx.p1copies() |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
61 p2copies = ctx.p2copies() |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
62 filesadded, filesremoved = None, None |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
63 with repo.lock(), repo.transaction(b"commit") as tr: |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
64 if ctx.manifestnode(): |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
65 # reuse an existing manifest revision |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
66 repo.ui.debug(b'reusing known manifest\n') |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
67 mn = ctx.manifestnode() |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
68 files = ctx.files() |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
69 if writechangesetcopy: |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
70 filesadded = ctx.filesadded() |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
71 filesremoved = ctx.filesremoved() |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
72 elif not ctx.files(): |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
73 repo.ui.debug(b'reusing manifest from p1 (no file change)\n') |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
74 mn = p1.manifestnode() |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
75 files = [] |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
76 else: |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
77 m1ctx = p1.manifestctx() |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
78 m2ctx = p2.manifestctx() |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
79 mctx = m1ctx.copy() |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
80 |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
81 m = mctx.read() |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
82 m1 = m1ctx.read() |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
83 m2 = m2ctx.read() |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
84 |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
85 # check in files |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
86 added = [] |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
87 filesadded = [] |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
88 removed = list(ctx.removed()) |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
89 touched = [] |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
90 linkrev = len(repo) |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
91 repo.ui.note(_(b"committing files:\n")) |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
92 uipathfn = scmutil.getuipathfn(repo) |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
93 for f in sorted(ctx.modified() + ctx.added()): |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
94 repo.ui.note(uipathfn(f) + b"\n") |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
95 try: |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
96 fctx = ctx[f] |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
97 if fctx is None: |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
98 removed.append(f) |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
99 else: |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
100 added.append(f) |
45204
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
101 m[f], is_touched = _filecommit( |
45230
5d0998ccedbb
commitctx: stop using weakref proxy for transaction
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45223
diff
changeset
|
102 repo, fctx, m1, m2, linkrev, tr, writefilecopymeta, |
45203
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
103 ) |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
104 if is_touched: |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
105 touched.append(f) |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
106 if writechangesetcopy and is_touched == 'added': |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
107 filesadded.append(f) |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
108 m.setflag(f, fctx.flags()) |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
109 except OSError: |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
110 repo.ui.warn(_(b"trouble committing %s!\n") % uipathfn(f)) |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
111 raise |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
112 except IOError as inst: |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
113 errcode = getattr(inst, 'errno', errno.ENOENT) |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
114 if error or errcode and errcode != errno.ENOENT: |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
115 repo.ui.warn( |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
116 _(b"trouble committing %s!\n") % uipathfn(f) |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
117 ) |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
118 raise |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
119 |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
120 # update manifest |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
121 removed = [f for f in removed if f in m1 or f in m2] |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
122 drop = sorted([f for f in removed if f in m]) |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
123 for f in drop: |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
124 del m[f] |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
125 if p2.rev() != nullrev: |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
126 rf = metadata.get_removal_filter(ctx, (p1, p2, m1, m2)) |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
127 removed = [f for f in removed if not rf(f)] |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
128 |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
129 touched.extend(removed) |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
130 |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
131 if writechangesetcopy: |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
132 filesremoved = removed |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
133 |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
134 files = touched |
45231
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
135 mn = _commit_manifest(tr, linkrev, ctx, mctx, files, added, drop) |
45203
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
136 |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
137 if writecopiesto == b'changeset-only': |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
138 # If writing only to changeset extras, use None to indicate that |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
139 # no entry should be written. If writing to both, write an empty |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
140 # entry to prevent the reader from falling back to reading |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
141 # filelogs. |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
142 p1copies = p1copies or None |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
143 p2copies = p2copies or None |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
144 filesadded = filesadded or None |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
145 filesremoved = filesremoved or None |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
146 |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
147 if origctx and origctx.manifestnode() == mn: |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
148 files = origctx.files() |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
149 |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
150 # update changelog |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
151 repo.ui.note(_(b"committing changelog\n")) |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
152 repo.changelog.delayupdate(tr) |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
153 n = repo.changelog.add( |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
154 mn, |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
155 files, |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
156 ctx.description(), |
45230
5d0998ccedbb
commitctx: stop using weakref proxy for transaction
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45223
diff
changeset
|
157 tr, |
45203
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
158 p1.node(), |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
159 p2.node(), |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
160 user, |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
161 ctx.date(), |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
162 ctx.extra().copy(), |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
163 p1copies, |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
164 p2copies, |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
165 filesadded, |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
166 filesremoved, |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
167 ) |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
168 xp1, xp2 = p1.hex(), p2 and p2.hex() or b'' |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
169 repo.hook( |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
170 b'pretxncommit', throw=True, node=hex(n), parent1=xp1, parent2=xp2, |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
171 ) |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
172 # set the new commit is proper phase |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
173 targetphase = subrepoutil.newcommitphase(repo.ui, ctx) |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
174 if targetphase: |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
175 # retract boundary do not alter parent changeset. |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
176 # if a parent have higher the resulting phase will |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
177 # be compliant anyway |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
178 # |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
179 # if minimal phase was 0 we don't need to retract anything |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
180 phases.registernew(repo, tr, targetphase, [n]) |
ae5c1a3bc339
commitctx: extract the function in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
181 return n |
45204
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
182 |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
183 |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
184 def _filecommit( |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
185 repo, fctx, manifest1, manifest2, linkrev, tr, includecopymeta, |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
186 ): |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
187 """ |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
188 commit an individual file as part of a larger transaction |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
189 |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
190 input: |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
191 |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
192 fctx: a file context with the content we are trying to commit |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
193 manifest1: manifest of changeset first parent |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
194 manifest2: manifest of changeset second parent |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
195 linkrev: revision number of the changeset being created |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
196 tr: current transation |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
197 individual: boolean, set to False to skip storing the copy data |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
198 (only used by the Google specific feature of using |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
199 changeset extra as copy source of truth). |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
200 |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
201 output: (filenode, touched) |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
202 |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
203 filenode: the filenode that should be used by this changeset |
45223
d056a131c93f
commitctx: document the None return for "touched" value
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45204
diff
changeset
|
204 touched: one of: None (mean untouched), 'added' or 'modified' |
45204
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
205 """ |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
206 |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
207 fname = fctx.path() |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
208 fparent1 = manifest1.get(fname, nullid) |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
209 fparent2 = manifest2.get(fname, nullid) |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
210 touched = None |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
211 if fparent1 == fparent2 == nullid: |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
212 touched = 'added' |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
213 |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
214 if isinstance(fctx, context.filectx): |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
215 # This block fast path most comparisons which are usually done. It |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
216 # assumes that bare filectx is used and no merge happened, hence no |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
217 # need to create a new file revision in this case. |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
218 node = fctx.filenode() |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
219 if node in [fparent1, fparent2]: |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
220 repo.ui.debug(b'reusing %s filelog entry\n' % fname) |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
221 if ( |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
222 fparent1 != nullid and manifest1.flags(fname) != fctx.flags() |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
223 ) or ( |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
224 fparent2 != nullid and manifest2.flags(fname) != fctx.flags() |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
225 ): |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
226 touched = 'modified' |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
227 return node, touched |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
228 |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
229 flog = repo.file(fname) |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
230 meta = {} |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
231 cfname = fctx.copysource() |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
232 fnode = None |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
233 |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
234 if cfname and cfname != fname: |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
235 # Mark the new revision of this file as a copy of another |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
236 # file. This copy data will effectively act as a parent |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
237 # of this new revision. If this is a merge, the first |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
238 # parent will be the nullid (meaning "look up the copy data") |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
239 # and the second one will be the other parent. For example: |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
240 # |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
241 # 0 --- 1 --- 3 rev1 changes file foo |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
242 # \ / rev2 renames foo to bar and changes it |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
243 # \- 2 -/ rev3 should have bar with all changes and |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
244 # should record that bar descends from |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
245 # bar in rev2 and foo in rev1 |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
246 # |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
247 # this allows this merge to succeed: |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
248 # |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
249 # 0 --- 1 --- 3 rev4 reverts the content change from rev2 |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
250 # \ / merging rev3 and rev4 should use bar@rev2 |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
251 # \- 2 --- 4 as the merge base |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
252 # |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
253 |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
254 cnode = manifest1.get(cfname) |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
255 newfparent = fparent2 |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
256 |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
257 if manifest2: # branch merge |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
258 if fparent2 == nullid or cnode is None: # copied on remote side |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
259 if cfname in manifest2: |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
260 cnode = manifest2[cfname] |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
261 newfparent = fparent1 |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
262 |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
263 # Here, we used to search backwards through history to try to find |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
264 # where the file copy came from if the source of a copy was not in |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
265 # the parent directory. However, this doesn't actually make sense to |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
266 # do (what does a copy from something not in your working copy even |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
267 # mean?) and it causes bugs (eg, issue4476). Instead, we will warn |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
268 # the user that copy information was dropped, so if they didn't |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
269 # expect this outcome it can be fixed, but this is the correct |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
270 # behavior in this circumstance. |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
271 |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
272 if cnode: |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
273 repo.ui.debug(b" %s: copy %s:%s\n" % (fname, cfname, hex(cnode))) |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
274 if includecopymeta: |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
275 meta[b"copy"] = cfname |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
276 meta[b"copyrev"] = hex(cnode) |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
277 fparent1, fparent2 = nullid, newfparent |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
278 else: |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
279 repo.ui.warn( |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
280 _( |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
281 b"warning: can't find ancestor for '%s' " |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
282 b"copied from '%s'!\n" |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
283 ) |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
284 % (fname, cfname) |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
285 ) |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
286 |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
287 elif fparent1 == nullid: |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
288 fparent1, fparent2 = fparent2, nullid |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
289 elif fparent2 != nullid: |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
290 # is one parent an ancestor of the other? |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
291 fparentancestors = flog.commonancestorsheads(fparent1, fparent2) |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
292 if fparent1 in fparentancestors: |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
293 fparent1, fparent2 = fparent2, nullid |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
294 elif fparent2 in fparentancestors: |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
295 fparent2 = nullid |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
296 elif not fparentancestors: |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
297 # TODO: this whole if-else might be simplified much more |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
298 ms = mergestate.mergestate.read(repo) |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
299 if ( |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
300 fname in ms |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
301 and ms[fname] == mergestate.MERGE_RECORD_MERGED_OTHER |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
302 ): |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
303 fparent1, fparent2 = fparent2, nullid |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
304 |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
305 # is the file changed? |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
306 text = fctx.data() |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
307 if fparent2 != nullid or meta or flog.cmp(fparent1, text): |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
308 if touched is None: # do not overwrite added |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
309 touched = 'modified' |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
310 fnode = flog.add(text, meta, tr, linkrev, fparent1, fparent2) |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
311 # are just the flags changed during merge? |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
312 elif fname in manifest1 and manifest1.flags(fname) != fctx.flags(): |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
313 touched = 'modified' |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
314 fnode = fparent1 |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
315 else: |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
316 fnode = fparent1 |
ce9ee81df9ff
commitctx: extract _filecommit too
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45203
diff
changeset
|
317 return fnode, touched |
45231
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
318 |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
319 |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
320 def _commit_manifest(tr, linkrev, ctx, mctx, files, added, drop): |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
321 """make a new manifest entry (or reuse a new one) |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
322 |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
323 given an initialised manifest context and precomputed list of |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
324 - files: files affected by the commit |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
325 - added: new entries in the manifest |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
326 - drop: entries present in parents but absent of this one |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
327 |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
328 Create a new manifest revision, reuse existing ones if possible. |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
329 |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
330 Return the nodeid of the manifest revision. |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
331 """ |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
332 repo = ctx.repo() |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
333 |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
334 md = None |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
335 |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
336 # all this is cached, so it is find to get them all from the ctx. |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
337 p1 = ctx.p1() |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
338 p2 = ctx.p2() |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
339 m1ctx = p1.manifestctx() |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
340 |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
341 m1 = m1ctx.read() |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
342 |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
343 manifest = mctx.read() |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
344 |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
345 if not files: |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
346 # if no "files" actually changed in terms of the changelog, |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
347 # try hard to detect unmodified manifest entry so that the |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
348 # exact same commit can be reproduced later on convert. |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
349 md = m1.diff(manifest, scmutil.matchfiles(repo, ctx.files())) |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
350 if not files and md: |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
351 repo.ui.debug( |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
352 b'not reusing manifest (no file change in ' |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
353 b'changelog, but manifest differs)\n' |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
354 ) |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
355 if files or md: |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
356 repo.ui.note(_(b"committing manifest\n")) |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
357 # we're using narrowmatch here since it's already applied at |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
358 # other stages (such as dirstate.walk), so we're already |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
359 # ignoring things outside of narrowspec in most cases. The |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
360 # one case where we might have files outside the narrowspec |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
361 # at this point is merges, and we already error out in the |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
362 # case where the merge has files outside of the narrowspec, |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
363 # so this is safe. |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
364 mn = mctx.write( |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
365 tr, |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
366 linkrev, |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
367 p1.manifestnode(), |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
368 p2.manifestnode(), |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
369 added, |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
370 drop, |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
371 match=repo.narrowmatch(), |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
372 ) |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
373 else: |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
374 repo.ui.debug( |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
375 b'reusing manifest from p1 (listed files ' b'actually unchanged)\n' |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
376 ) |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
377 mn = p1.manifestnode() |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
378 |
f0d4d1343cb4
commitctx: extract the function that commit a new manifest
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45230
diff
changeset
|
379 return mn |