author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
Sat, 02 Feb 2013 12:20:10 +0100 | |
branch | stable |
changeset 662 | 40854e956315 |
parent 630 | 722b52c75f02 |
permissions | -rw-r--r-- |
519
9825c7da5b54
ensure all file have a copyright notice
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
491
diff
changeset
|
1 |
# Copyright 2011 Logilab SA <contact@logilab.fr> |
228
5a17c0d41a00
proof-read documentation and docstrings
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
220
diff
changeset
|
2 |
"""synchronize patches queues and evolving changesets""" |
153
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
3 |
|
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
4 |
import re |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
5 |
from cStringIO import StringIO |
220
ff3158d0d7e8
qsync: support for synchronisation with applied patches from outer space and more
David Douard <david.douard@logilab.fr>
parents:
216
diff
changeset
|
6 |
import json |
153
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
7 |
|
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
8 |
from mercurial.i18n import _ |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
9 |
from mercurial import commands |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
10 |
from mercurial import patch |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
11 |
from mercurial import util |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
12 |
from mercurial.node import nullid, hex, short, bin |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
13 |
from mercurial import cmdutil |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
14 |
from mercurial import hg |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
15 |
from mercurial import scmutil |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
16 |
from mercurial import error |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
17 |
from mercurial import extensions |
220
ff3158d0d7e8
qsync: support for synchronisation with applied patches from outer space and more
David Douard <david.douard@logilab.fr>
parents:
216
diff
changeset
|
18 |
from mercurial import phases |
630
722b52c75f02
compat: adapt to upstreaming of divergent logic
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
608
diff
changeset
|
19 |
from mercurial import obsolete |
153
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
20 |
|
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
21 |
### old compat code |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
22 |
############################# |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
23 |
|
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
24 |
BRANCHNAME="qsubmit2" |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
25 |
|
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
26 |
### new command |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
27 |
############################# |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
28 |
cmdtable = {} |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
29 |
command = cmdutil.command(cmdtable) |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
30 |
|
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
31 |
@command('^qsync|sync', |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
32 |
[ |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
33 |
('a', 'review-all', False, _('mark all touched patches ready for review (no editor)')), |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
34 |
], |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
35 |
'') |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
36 |
def cmdsync(ui, repo, **opts): |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
37 |
'''Export draft changeset as mq patch in a mq patches repository commit. |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
38 |
|
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
39 |
This command get all changesets in draft phase and create an mq changeset: |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
40 |
|
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
41 |
* on a "qsubmit2" branch (based on the last changeset) |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
42 |
|
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
43 |
* one patch per draft changeset |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
44 |
|
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
45 |
* a series files listing all generated patch |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
46 |
|
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
47 |
* qsubmitdata holding useful information |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
48 |
|
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
49 |
It does use obsolete relation to update patches that already existing in the qsubmit2 branch. |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
50 |
|
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
51 |
Already existing patch which became public, draft or got killed are remove from the mq repo. |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
52 |
|
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
53 |
Patch name are generated using the summary line for changeset description. |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
54 |
|
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
55 |
.. warning:: Series files is ordered topologically. So two series with |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
56 |
interleaved changeset will appear interleaved. |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
57 |
''' |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
58 |
|
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
59 |
review = 'edit' |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
60 |
if opts['review_all']: |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
61 |
review = 'all' |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
62 |
mqrepo = repo.mq.qrepo() |
251
a60d11973ff3
[qsync] abort properly of a patches repository does not exists
David Douard <david.douard@logilab.fr>
parents:
249
diff
changeset
|
63 |
if mqrepo is None: |
a60d11973ff3
[qsync] abort properly of a patches repository does not exists
David Douard <david.douard@logilab.fr>
parents:
249
diff
changeset
|
64 |
raise util.Abort('No patches repository') |
a60d11973ff3
[qsync] abort properly of a patches repository does not exists
David Douard <david.douard@logilab.fr>
parents:
249
diff
changeset
|
65 |
|
153
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
66 |
try: |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
67 |
parent = mqrepo[BRANCHNAME] |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
68 |
except error.RepoLookupError: |
220
ff3158d0d7e8
qsync: support for synchronisation with applied patches from outer space and more
David Douard <david.douard@logilab.fr>
parents:
216
diff
changeset
|
69 |
parent = initqsubmit(mqrepo) |
153
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
70 |
store, data, touched = fillstore(repo, parent) |
607
b80de587d72d
[qsync] fix filestore usage
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
519
diff
changeset
|
71 |
try: |
b80de587d72d
[qsync] fix filestore usage
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
519
diff
changeset
|
72 |
if not touched: |
b80de587d72d
[qsync] fix filestore usage
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
519
diff
changeset
|
73 |
raise util.Abort('Nothing changed') |
b80de587d72d
[qsync] fix filestore usage
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
519
diff
changeset
|
74 |
files = ['qsubmitdata', 'series'] + touched |
b80de587d72d
[qsync] fix filestore usage
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
519
diff
changeset
|
75 |
# mark some as ready for review |
b80de587d72d
[qsync] fix filestore usage
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
519
diff
changeset
|
76 |
message = 'qsubmit commit\n\n' |
b80de587d72d
[qsync] fix filestore usage
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
519
diff
changeset
|
77 |
review_list = [] |
b80de587d72d
[qsync] fix filestore usage
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
519
diff
changeset
|
78 |
applied_list = [] |
b80de587d72d
[qsync] fix filestore usage
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
519
diff
changeset
|
79 |
if review: |
b80de587d72d
[qsync] fix filestore usage
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
519
diff
changeset
|
80 |
olddata = get_old_data(parent) |
b80de587d72d
[qsync] fix filestore usage
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
519
diff
changeset
|
81 |
oldfiles = dict([(name, bin(ctxhex)) for ctxhex, name in olddata]) |
220
ff3158d0d7e8
qsync: support for synchronisation with applied patches from outer space and more
David Douard <david.douard@logilab.fr>
parents:
216
diff
changeset
|
82 |
|
607
b80de587d72d
[qsync] fix filestore usage
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
519
diff
changeset
|
83 |
for patch_name in touched: |
b80de587d72d
[qsync] fix filestore usage
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
519
diff
changeset
|
84 |
try: |
b80de587d72d
[qsync] fix filestore usage
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
519
diff
changeset
|
85 |
store.getfile(patch_name) |
b80de587d72d
[qsync] fix filestore usage
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
519
diff
changeset
|
86 |
review_list.append(patch_name) |
608 | 87 |
except IOError: |
607
b80de587d72d
[qsync] fix filestore usage
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
519
diff
changeset
|
88 |
oldnode = oldfiles[patch_name] |
630
722b52c75f02
compat: adapt to upstreaming of divergent logic
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
608
diff
changeset
|
89 |
newnodes = obsolete.successorssets(repo, oldnode) |
607
b80de587d72d
[qsync] fix filestore usage
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
519
diff
changeset
|
90 |
if newnodes: |
b80de587d72d
[qsync] fix filestore usage
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
519
diff
changeset
|
91 |
newnodes = [n for n in newnodes if n and n[0] in repo] # remove killing |
b80de587d72d
[qsync] fix filestore usage
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
519
diff
changeset
|
92 |
if not newnodes: |
b80de587d72d
[qsync] fix filestore usage
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
519
diff
changeset
|
93 |
# changeset has been killed (eg. reject) |
b80de587d72d
[qsync] fix filestore usage
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
519
diff
changeset
|
94 |
pass |
220
ff3158d0d7e8
qsync: support for synchronisation with applied patches from outer space and more
David Douard <david.douard@logilab.fr>
parents:
216
diff
changeset
|
95 |
else: |
607
b80de587d72d
[qsync] fix filestore usage
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
519
diff
changeset
|
96 |
assert len(newnodes) == 1 # conflict!!! |
b80de587d72d
[qsync] fix filestore usage
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
519
diff
changeset
|
97 |
newnode = newnodes[0] |
b80de587d72d
[qsync] fix filestore usage
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
519
diff
changeset
|
98 |
assert len(newnode) == 1 # split unsupported for now |
b80de587d72d
[qsync] fix filestore usage
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
519
diff
changeset
|
99 |
newnode = list(newnode)[0] |
b80de587d72d
[qsync] fix filestore usage
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
519
diff
changeset
|
100 |
# XXX unmanaged case where a cs is obsoleted by an unavailable one |
b80de587d72d
[qsync] fix filestore usage
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
519
diff
changeset
|
101 |
#if newnode.node() not in repo.changelog.nodemap: |
b80de587d72d
[qsync] fix filestore usage
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
519
diff
changeset
|
102 |
# raise util.Abort('%s is obsoleted by an unknown node %s'% (oldnode, newnode)) |
b80de587d72d
[qsync] fix filestore usage
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
519
diff
changeset
|
103 |
ctx = repo[newnode] |
b80de587d72d
[qsync] fix filestore usage
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
519
diff
changeset
|
104 |
if ctx.phase() == phases.public: |
b80de587d72d
[qsync] fix filestore usage
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
519
diff
changeset
|
105 |
# applied |
b80de587d72d
[qsync] fix filestore usage
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
519
diff
changeset
|
106 |
applied_list.append(patch_name) |
b80de587d72d
[qsync] fix filestore usage
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
519
diff
changeset
|
107 |
elif ctx.phase() == phases.secret: |
b80de587d72d
[qsync] fix filestore usage
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
519
diff
changeset
|
108 |
# already exported changeset is now secret |
b80de587d72d
[qsync] fix filestore usage
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
519
diff
changeset
|
109 |
repo.ui.warn("An already exported changeset is now secret!!!") |
b80de587d72d
[qsync] fix filestore usage
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
519
diff
changeset
|
110 |
else: |
b80de587d72d
[qsync] fix filestore usage
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
519
diff
changeset
|
111 |
# draft |
b80de587d72d
[qsync] fix filestore usage
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
519
diff
changeset
|
112 |
assert False, "Should be exported" |
153
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
113 |
|
607
b80de587d72d
[qsync] fix filestore usage
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
519
diff
changeset
|
114 |
if review: |
b80de587d72d
[qsync] fix filestore usage
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
519
diff
changeset
|
115 |
if applied_list: |
b80de587d72d
[qsync] fix filestore usage
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
519
diff
changeset
|
116 |
message += '\n'.join('* applied %s' % x for x in applied_list) + '\n' |
b80de587d72d
[qsync] fix filestore usage
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
519
diff
changeset
|
117 |
if review_list: |
b80de587d72d
[qsync] fix filestore usage
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
519
diff
changeset
|
118 |
message += '\n'.join('* %s ready for review' % x for x in review_list) + '\n' |
b80de587d72d
[qsync] fix filestore usage
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
519
diff
changeset
|
119 |
memctx = patch.makememctx(mqrepo, (parent.node(), nullid), |
b80de587d72d
[qsync] fix filestore usage
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
519
diff
changeset
|
120 |
message, |
b80de587d72d
[qsync] fix filestore usage
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
519
diff
changeset
|
121 |
None, |
b80de587d72d
[qsync] fix filestore usage
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
519
diff
changeset
|
122 |
None, |
b80de587d72d
[qsync] fix filestore usage
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
519
diff
changeset
|
123 |
parent.branch(), files, store, |
b80de587d72d
[qsync] fix filestore usage
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
519
diff
changeset
|
124 |
editor=None) |
b80de587d72d
[qsync] fix filestore usage
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
519
diff
changeset
|
125 |
if review == 'edit': |
b80de587d72d
[qsync] fix filestore usage
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
519
diff
changeset
|
126 |
memctx._text = cmdutil.commitforceeditor(mqrepo, memctx, []) |
b80de587d72d
[qsync] fix filestore usage
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
519
diff
changeset
|
127 |
mqrepo.savecommitmessage(memctx.description()) |
b80de587d72d
[qsync] fix filestore usage
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
519
diff
changeset
|
128 |
n = memctx.commit() |
b80de587d72d
[qsync] fix filestore usage
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
519
diff
changeset
|
129 |
finally: |
b80de587d72d
[qsync] fix filestore usage
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
519
diff
changeset
|
130 |
store.close() |
153
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
131 |
return 0 |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
132 |
|
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
133 |
|
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
134 |
def makename(ctx): |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
135 |
"""create a patch name form a changeset""" |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
136 |
descsummary = ctx.description().splitlines()[0] |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
137 |
descsummary = re.sub(r'\s+', '_', descsummary) |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
138 |
descsummary = re.sub(r'\W+', '', descsummary) |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
139 |
if len(descsummary) > 45: |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
140 |
descsummary = descsummary[:42] + '.' |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
141 |
return '%s-%s.diff' % (ctx.branch().upper(), descsummary) |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
142 |
|
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
143 |
|
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
144 |
def get_old_data(mqctx): |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
145 |
"""read qsubmit data to fetch previous export data |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
146 |
|
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
147 |
get old data from the content of an mq commit""" |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
148 |
try: |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
149 |
old_data = mqctx['qsubmitdata'] |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
150 |
return json.loads(old_data.data()) |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
151 |
except error.LookupError: |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
152 |
return [] |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
153 |
|
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
154 |
def get_current_data(repo): |
220
ff3158d0d7e8
qsync: support for synchronisation with applied patches from outer space and more
David Douard <david.douard@logilab.fr>
parents:
216
diff
changeset
|
155 |
"""Return what would be exported if no previous data exists""" |
153
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
156 |
data = [] |
195
ccbadfae1d06
ignore merge in qsync
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
153
diff
changeset
|
157 |
for ctx in repo.set('draft() - (obsolete() + merge())'): |
153
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
158 |
name = makename(ctx) |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
159 |
data.append([ctx.hex(), makename(ctx)]) |
195
ccbadfae1d06
ignore merge in qsync
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
153
diff
changeset
|
160 |
merges = repo.revs('draft() and merge()') |
ccbadfae1d06
ignore merge in qsync
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
153
diff
changeset
|
161 |
if merges: |
ccbadfae1d06
ignore merge in qsync
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
153
diff
changeset
|
162 |
repo.ui.warn('ignoring %i merge\n' % len(merges)) |
153
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
163 |
return data |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
164 |
|
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
165 |
|
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
166 |
def patchmq(repo, store, olddata, newdata): |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
167 |
"""export the mq patches and return all useful data to be exported""" |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
168 |
finaldata = [] |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
169 |
touched = set() |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
170 |
currentdrafts = set(d[0] for d in newdata) |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
171 |
usednew = set() |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
172 |
usedold = set() |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
394
diff
changeset
|
173 |
evolve = extensions.find('evolve') |
153
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
174 |
for oldhex, oldname in olddata: |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
175 |
if oldhex in usedold: |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
176 |
continue # no duplicate |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
177 |
usedold.add(oldhex) |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
178 |
oldname = str(oldname) |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
179 |
oldnode = bin(oldhex) |
630
722b52c75f02
compat: adapt to upstreaming of divergent logic
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
608
diff
changeset
|
180 |
newnodes = obsolete.successorssets(repo, oldnode) |
153
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
181 |
if newnodes: |
394
f2168d0b5700
qsync: ignore unexistent nodes
David Douard <david.douard@logilab.fr>
parents:
289
diff
changeset
|
182 |
newnodes = [n for n in newnodes if n and n[0] in repo] # remove killing |
153
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
183 |
if len(newnodes) > 1: |
201
94360b577857
qsync: display short node repr on error
David Douard <david.douard@logilab.fr>
parents:
195
diff
changeset
|
184 |
newnodes = [short(nodes[0]) for nodes in newnodes] |
153
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
185 |
raise util.Abort('%s have more than one newer version: %s'% (oldname, newnodes)) |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
186 |
if newnodes: |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
187 |
# else, changeset have been killed |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
188 |
newnode = list(newnodes)[0][0] |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
189 |
ctx = repo[newnode] |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
190 |
if ctx.hex() != oldhex and ctx.phase(): |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
191 |
fp = StringIO() |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
192 |
cmdutil.export(repo, [ctx.rev()], fp=fp) |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
193 |
data = fp.getvalue() |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
194 |
store.setfile(oldname, data, (None, None)) |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
195 |
finaldata.append([ctx.hex(), oldname]) |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
196 |
usednew.add(ctx.hex()) |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
197 |
touched.add(oldname) |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
198 |
continue |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
199 |
if oldhex in currentdrafts: |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
200 |
# else changeset is now public or secret |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
201 |
finaldata.append([oldhex, oldname]) |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
202 |
usednew.add(ctx.hex()) |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
203 |
continue |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
204 |
touched.add(oldname) |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
205 |
|
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
206 |
for newhex, newname in newdata: |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
207 |
if newhex in usednew: |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
208 |
continue |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
209 |
newnode = bin(newhex) |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
210 |
ctx = repo[newnode] |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
211 |
fp = StringIO() |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
212 |
cmdutil.export(repo, [ctx.rev()], fp=fp) |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
213 |
data = fp.getvalue() |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
214 |
store.setfile(newname, data, (None, None)) |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
215 |
finaldata.append([ctx.hex(), newname]) |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
216 |
touched.add(newname) |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
217 |
# sort by branchrev number |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
218 |
finaldata.sort(key=lambda x: sort_key(repo[x[0]])) |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
219 |
# sort touched too (ease review list) |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
220 |
stouched = [f[1] for f in finaldata if f[1] in touched] |
220
ff3158d0d7e8
qsync: support for synchronisation with applied patches from outer space and more
David Douard <david.douard@logilab.fr>
parents:
216
diff
changeset
|
221 |
stouched += [x for x in touched if x not in stouched] |
153
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
222 |
return finaldata, stouched |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
223 |
|
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
224 |
def sort_key(ctx): |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
225 |
"""ctx sort key: (branch, rev)""" |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
226 |
return (ctx.branch(), ctx.rev()) |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
227 |
|
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
228 |
|
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
229 |
def fillstore(repo, basemqctx): |
220
ff3158d0d7e8
qsync: support for synchronisation with applied patches from outer space and more
David Douard <david.douard@logilab.fr>
parents:
216
diff
changeset
|
230 |
"""fill store with patch data""" |
153
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
231 |
olddata = get_old_data(basemqctx) |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
232 |
newdata = get_current_data(repo) |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
233 |
store = patch.filestore() |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
234 |
try: |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
235 |
data, touched = patchmq(repo, store, olddata, newdata) |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
236 |
# put all name in the series |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
237 |
series ='\n'.join(d[1] for d in data) + '\n' |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
238 |
store.setfile('series', series, (False, False)) |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
239 |
|
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
240 |
# export data to ease futur work |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
241 |
store.setfile('qsubmitdata', json.dumps(data, indent=True), |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
242 |
(False, False)) |
607
b80de587d72d
[qsync] fix filestore usage
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
519
diff
changeset
|
243 |
except: |
153
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
244 |
store.close() |
607
b80de587d72d
[qsync] fix filestore usage
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
519
diff
changeset
|
245 |
raise |
153
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
246 |
return store, data, touched |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
247 |
|
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
248 |
|
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
249 |
def initqsubmit(mqrepo): |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
250 |
"""create initial qsubmit branch""" |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
251 |
store = patch.filestore() |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
252 |
try: |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
253 |
files = set() |
216
9400e234b3d7
qsync: add a warning file in qsync changeset.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
201
diff
changeset
|
254 |
store.setfile('DO-NOT-EDIT-THIS-WORKING-COPY-BY-HAND', 'WE WARNED YOU!', (False, False)) |
153
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
255 |
store.setfile('.hgignore', '^status$\n', (False, False)) |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
256 |
memctx = patch.makememctx(mqrepo, (nullid, nullid), |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
257 |
'qsubmit init', |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
258 |
None, |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
259 |
None, |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
260 |
BRANCHNAME, ('.hgignore',), store, |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
261 |
editor=None) |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
262 |
mqrepo.savecommitmessage(memctx.description()) |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
263 |
n = memctx.commit() |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
264 |
finally: |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
265 |
store.close() |
c088f503cc97
add qsync extension to mutable history
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
266 |
return mqrepo[n] |