##// 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 155 (forces target IDs to change). It takes a boolean argument and
156 156 defaults to False.
157 157
158 :convert.hg.startrev: convert start revision and its descendants.
159 It takes a hg revision identifier and defaults to 0.
158 :convert.hg.revs: revset specifying the source revisions to convert.
160 159
161 160 CVS Source
162 161 ##########
@@ -21,7 +21,7 b''
21 21 import os, time, cStringIO
22 22 from mercurial.i18n import _
23 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 26 from common import NoRepo, commit, converter_source, converter_sink
27 27
@@ -252,6 +252,8 b' class mercurial_source(converter_source)'
252 252 self.convertfp = None
253 253 # Restrict converted revisions to startrev descendants
254 254 startnode = ui.config('convert', 'hg.startrev')
255 hgrevs = ui.config('convert', 'hg.revs')
256 if hgrevs is None:
255 257 if startnode is not None:
256 258 try:
257 259 startnode = self.repo.lookup(startnode)
@@ -269,6 +271,18 b' class mercurial_source(converter_source)'
269 271 self._heads = [self.repo[rev].node()]
270 272 else:
271 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 287 def changectx(self, rev):
274 288 if self.lastrev != rev:
@@ -183,3 +183,23 b' Convert from merge'
183 183 b
184 184 $ hg -q verify
185 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 135 store original revision ID in changeset (forces target IDs
136 136 to change). It takes a boolean argument and defaults to
137 137 False.
138 convert.hg.startrev
139 convert start revision and its descendants. It takes a hg
140 revision identifier and defaults to 0.
138 convert.hg.revs
139 revset specifying the source revisions to convert.
141 140
142 141 CVS Source
143 142 ##########
General Comments 0
You need to be logged in to leave comments. Login now