22 scmutil, |
22 scmutil, |
23 subrepoutil, |
23 subrepoutil, |
24 ) |
24 ) |
25 |
25 |
26 |
26 |
27 def commitctx(repo, ctx, error=False, origctx=None): |
27 def _write_copy_meta(repo): |
28 """Add a new revision to the target repository. |
28 """return a (changelog, filelog) boolean tuple |
29 Revision information is passed via the context argument. |
29 |
30 |
30 changelog: copy related information should be stored in the changeset |
31 ctx.files() should list all files involved in this commit, i.e. |
31 filelof: copy related information should be written in the file revision |
32 modified/added/removed files. On merge, it may be wider than the |
32 """ |
33 ctx.files() to be committed, since any file nodes derived directly |
|
34 from p1 or p2 are excluded from the committed ctx.files(). |
|
35 |
|
36 origctx is for convert to work around the problem that bug |
|
37 fixes to the files list in changesets change hashes. For |
|
38 convert to be the identity, it can pass an origctx and this |
|
39 function will use the same files list when it makes sense to |
|
40 do so. |
|
41 """ |
|
42 repo = repo.unfiltered() |
|
43 |
|
44 p1, p2 = ctx.p1(), ctx.p2() |
|
45 user = ctx.user() |
|
46 |
|
47 if repo.filecopiesmode == b'changeset-sidedata': |
33 if repo.filecopiesmode == b'changeset-sidedata': |
48 writechangesetcopy = True |
34 writechangesetcopy = True |
49 writefilecopymeta = True |
35 writefilecopymeta = True |
50 else: |
36 else: |
51 writecopiesto = repo.ui.config(b'experimental', b'copies.write-to') |
37 writecopiesto = repo.ui.config(b'experimental', b'copies.write-to') |
52 writefilecopymeta = writecopiesto != b'changeset-only' |
38 writefilecopymeta = writecopiesto != b'changeset-only' |
53 writechangesetcopy = writecopiesto in ( |
39 writechangesetcopy = writecopiesto in ( |
54 b'changeset-only', |
40 b'changeset-only', |
55 b'compatibility', |
41 b'compatibility', |
56 ) |
42 ) |
|
43 return writechangesetcopy, writefilecopymeta |
|
44 |
|
45 |
|
46 def commitctx(repo, ctx, error=False, origctx=None): |
|
47 """Add a new revision to the target repository. |
|
48 Revision information is passed via the context argument. |
|
49 |
|
50 ctx.files() should list all files involved in this commit, i.e. |
|
51 modified/added/removed files. On merge, it may be wider than the |
|
52 ctx.files() to be committed, since any file nodes derived directly |
|
53 from p1 or p2 are excluded from the committed ctx.files(). |
|
54 |
|
55 origctx is for convert to work around the problem that bug |
|
56 fixes to the files list in changesets change hashes. For |
|
57 convert to be the identity, it can pass an origctx and this |
|
58 function will use the same files list when it makes sense to |
|
59 do so. |
|
60 """ |
|
61 repo = repo.unfiltered() |
|
62 |
|
63 p1, p2 = ctx.p1(), ctx.p2() |
|
64 user = ctx.user() |
|
65 |
|
66 writechangesetcopy, writefilecopymeta = _write_copy_meta(repo) |
|
67 |
57 p1copies, p2copies = None, None |
68 p1copies, p2copies = None, None |
58 if writechangesetcopy: |
69 if writechangesetcopy: |
59 p1copies = ctx.p1copies() |
70 p1copies = ctx.p1copies() |
60 p2copies = ctx.p2copies() |
71 p2copies = ctx.p2copies() |
61 filesadded, filesremoved = None, None |
72 filesadded, filesremoved = None, None |