hgext/evolve.py
branchstable
changeset 1197 0d15d461a316
parent 1194 aa7cdd9d7310
parent 1196 9e3f332f7630
child 1198 bfe9be352453
--- a/hgext/evolve.py	Tue Jan 27 16:07:57 2015 +0000
+++ b/hgext/evolve.py	Fri Jan 30 21:57:41 2015 +0000
@@ -2394,7 +2394,10 @@
     while undecided:
 
         ui.note(_("sampling from both directions\n"))
-        sample = _takefullsample(dag, undecided, size=fullsamplesize)
+        if len(undecided) < fullsamplesize:
+            sample = set(undecided)
+        else:
+            sample = _takefullsample(dag, undecided, size=fullsamplesize)
 
         roundtrips += 1
         ui.debug("query %i; still undecided: %i, sample size is: %i\n"
@@ -2576,7 +2579,7 @@
     cl = pullop.repo.changelog
     remote = pullop.remote
     unfi = repo.unfiltered()
-    revs = unfi.revs('::%ln', pullop.common)
+    revs = unfi.revs('::(%ln - null)', pullop.common)
     common = [nullid]
     if remote.capable('_evoext_obshash_0'):
         obsexcmsg(repo.ui, "looking for common markers in %i nodes\n"
@@ -2764,6 +2767,31 @@
     for chg, obs in _obsrelsethashtree(repo):
         ui.status('%s %s\n' % (node.hex(chg), node.hex(obs)))
 
+_bestformat = max(obsolete.formats.keys())
+
+@command(
+    'debugobsconvert',
+    [('', 'new-format', _bestformat, _('Destination format for markers.'))],
+    '')
+def debugobsconvert(ui, repo, new_format):
+    if new_format == repo.obsstore._version:
+        msg = _('New format is the same as the old format, not upgrading!')
+        raise util.Abort(msg)
+    f = repo.sopener('obsstore', 'wb', atomictemp=True)
+    origmarkers = repo.obsstore._all
+    known = set()
+    markers = []
+    for m in origmarkers:
+        if m in known:
+            continue
+        known.add(m)
+        markers.append(m)
+    ui.write(_('Old store is version %d, will rewrite in version %d\n') % (
+        repo.obsstore._version, new_format))
+    map(f.write, obsolete.encodemarkers(markers, True, new_format))
+    f.close()
+    ui.write(_('Done!\n'))
+
 
 @eh.wrapfunction(wireproto, 'capabilities')
 def capabilities(orig, repo, proto):