##// END OF EJS Templates
engine: refactor actual cloning code into separate function...
Pulkit Goyal -
r46809:85f7cf31 default
parent child Browse files
Show More
@@ -118,6 +118,42 b' def matchrevlog(revlogfilter, entry):'
118 return UPGRADE_FILELOGS in revlogfilter
118 return UPGRADE_FILELOGS in revlogfilter
119
119
120
120
121 def _perform_clone(
122 ui,
123 dstrepo,
124 tr,
125 old_revlog,
126 unencoded,
127 deltareuse,
128 forcedeltabothparents,
129 revlogs,
130 sidedatacompanion,
131 oncopiedrevision,
132 ):
133 """ returns the new revlog object created"""
134 newrl = None
135 if matchrevlog(revlogs, unencoded):
136 ui.note(
137 _(b'cloning %d revisions from %s\n') % (len(old_revlog), unencoded)
138 )
139 newrl = _revlogfrompath(dstrepo, unencoded)
140 old_revlog.clone(
141 tr,
142 newrl,
143 addrevisioncb=oncopiedrevision,
144 deltareuse=deltareuse,
145 forcedeltabothparents=forcedeltabothparents,
146 sidedatacompanion=sidedatacompanion,
147 )
148 else:
149 msg = _(b'blindly copying %s containing %i revisions\n')
150 ui.note(msg % (unencoded, len(old_revlog)))
151 _copyrevlog(tr, dstrepo, old_revlog, unencoded)
152
153 newrl = _revlogfrompath(dstrepo, unencoded)
154 return newrl
155
156
121 def _clonerevlogs(
157 def _clonerevlogs(
122 ui,
158 ui,
123 srcrepo,
159 srcrepo,
@@ -292,26 +328,18 b' def _clonerevlogs('
292 _(b'file revisions'), total=frevcount
328 _(b'file revisions'), total=frevcount
293 )
329 )
294
330
295 if matchrevlog(revlogs, unencoded):
331 newrl = _perform_clone(
296 ui.note(
332 ui,
297 _(b'cloning %d revisions from %s\n') % (len(oldrl), unencoded)
333 dstrepo,
298 )
299 newrl = _revlogfrompath(dstrepo, unencoded)
300 oldrl.clone(
301 tr,
334 tr,
302 newrl,
335 oldrl,
303 addrevisioncb=oncopiedrevision,
336 unencoded,
304 deltareuse=deltareuse,
337 deltareuse,
305 forcedeltabothparents=forcedeltabothparents,
338 forcedeltabothparents,
306 sidedatacompanion=sidedatacompanion,
339 revlogs,
340 sidedatacompanion,
341 oncopiedrevision,
307 )
342 )
308 else:
309 msg = _(b'blindly copying %s containing %i revisions\n')
310 ui.note(msg % (unencoded, len(oldrl)))
311 _copyrevlog(tr, dstrepo, oldrl, unencoded)
312
313 newrl = _revlogfrompath(dstrepo, unencoded)
314
315 info = newrl.storageinfo(storedsize=True)
343 info = newrl.storageinfo(storedsize=True)
316 datasize = info[b'storedsize'] or 0
344 datasize = info[b'storedsize'] or 0
317
345
General Comments 0
You need to be logged in to leave comments. Login now