Pierre-Yves David committed 7db8107

obsolete: Only warn on bad obsolete marker

Older version probably created invalide one.

Comments (0)

Files changed (1)


 def cmddebugconvertobsolete(ui, repo):
     """import markers from an .hg/obsolete-relations file"""
     cnt = 0
+    error = 0
     l = repo.lock()
     some = False
             for oldmark in json.loads(data):
                 del oldmark['id'] # dropped for now
                 del oldmark['reason'] # unused until then
+                oldobject = oldmark['object']
+                oldsubjects = oldmark['subjects']
                 oldmark['subjects'] = [bin(n) for n in oldmark['subjects']]
                 oldmark['object'] = bin(oldmark['object'])
                 oldmark['date'] = '%i %i' % tuple(oldmark['date'])
-                store.create(oldmark.pop('object'),
-                             oldmark.pop('subjects'),
-                             0, oldmark)
+                assert oldmark['object'], repr(oldmark['object'])
+                try:
+                    store.create(oldmark.pop('object'),
+                                 oldmark.pop('subjects'),
+                                 0, oldmark)
+                except ValueError:
+                    repo.ui.write_err("invalid marker %s -> %s\n"
+                                 % (oldobject, oldsubjects))
+                    error += 1
                 cnt += 1
     if not some:
             ui.warn('nothing to do\n')
     ui.status('%i obsolete marker converted\n' % cnt)
+    if error:
+        ui.write_err('%i conversion failed. check you graph!\n' % error)
 @command('debugsuccessors', [], '')
 def cmddebugsuccessors(ui, repo):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.