##// END OF EJS Templates
convert: introduce hg.revs to replace hg.startrev and --rev with a revset...
Mads Kiilerich -
r19891:e271970b default
parent child Browse files
Show More
@@ -155,8 +155,7 b' def convert(ui, src, dest=None, revmapfi'
155 (forces target IDs to change). It takes a boolean argument and
155 (forces target IDs to change). It takes a boolean argument and
156 defaults to False.
156 defaults to False.
157
157
158 :convert.hg.startrev: convert start revision and its descendants.
158 :convert.hg.revs: revset specifying the source revisions to convert.
159 It takes a hg revision identifier and defaults to 0.
160
159
161 CVS Source
160 CVS Source
162 ##########
161 ##########
@@ -21,7 +21,7 b''
21 import os, time, cStringIO
21 import os, time, cStringIO
22 from mercurial.i18n import _
22 from mercurial.i18n import _
23 from mercurial.node import bin, hex, nullid
23 from mercurial.node import bin, hex, nullid
24 from mercurial import hg, util, context, bookmarks, error
24 from mercurial import hg, util, context, bookmarks, error, scmutil
25
25
26 from common import NoRepo, commit, converter_source, converter_sink
26 from common import NoRepo, commit, converter_source, converter_sink
27
27
@@ -252,6 +252,8 b' class mercurial_source(converter_source)'
252 self.convertfp = None
252 self.convertfp = None
253 # Restrict converted revisions to startrev descendants
253 # Restrict converted revisions to startrev descendants
254 startnode = ui.config('convert', 'hg.startrev')
254 startnode = ui.config('convert', 'hg.startrev')
255 hgrevs = ui.config('convert', 'hg.revs')
256 if hgrevs is None:
255 if startnode is not None:
257 if startnode is not None:
256 try:
258 try:
257 startnode = self.repo.lookup(startnode)
259 startnode = self.repo.lookup(startnode)
@@ -269,6 +271,18 b' class mercurial_source(converter_source)'
269 self._heads = [self.repo[rev].node()]
271 self._heads = [self.repo[rev].node()]
270 else:
272 else:
271 self._heads = self.repo.heads()
273 self._heads = self.repo.heads()
274 else:
275 if rev or startnode is not None:
276 raise util.Abort(_('hg.revs cannot be combined with '
277 'hg.startrev or --rev'))
278 nodes = set()
279 parents = set()
280 for r in scmutil.revrange(self.repo, [hgrevs]):
281 ctx = self.repo[r]
282 nodes.add(ctx.node())
283 parents.update(p.node() for p in ctx.parents())
284 self.keep = nodes.__contains__
285 self._heads = nodes - parents
272
286
273 def changectx(self, rev):
287 def changectx(self, rev):
274 if self.lastrev != rev:
288 if self.lastrev != rev:
@@ -183,3 +183,23 b' Convert from merge'
183 b
183 b
184 $ hg -q verify
184 $ hg -q verify
185 $ cd ..
185 $ cd ..
186
187 Convert from revset in convert.hg.revs
188
189 $ hg convert --config convert.hg.revs='3:4+0' source revsetrepo
190 initializing destination revsetrepo repository
191 scanning source...
192 sorting...
193 converting...
194 2 0: add a b f
195 1 3: change a
196 0 4: merge 2 and 3
197
198 $ glog revsetrepo
199 o 2 "4: merge 2 and 3" files: b c d e f
200 |
201 o 1 "3: change a" files: a
202 |
203 o 0 "0: add a b f" files: a b f
204
205 $ cd ..
@@ -135,9 +135,8 b''
135 store original revision ID in changeset (forces target IDs
135 store original revision ID in changeset (forces target IDs
136 to change). It takes a boolean argument and defaults to
136 to change). It takes a boolean argument and defaults to
137 False.
137 False.
138 convert.hg.startrev
138 convert.hg.revs
139 convert start revision and its descendants. It takes a hg
139 revset specifying the source revisions to convert.
140 revision identifier and defaults to 0.
141
140
142 CVS Source
141 CVS Source
143 ##########
142 ##########
General Comments 0
You need to be logged in to leave comments. Login now