Commits

Pierre-Yves David committed 7653f80

obsolete: harden convertion from first format

Comments (0)

Files changed (1)

hgext/obsolete.py

                         'date':  '%i %i' % util.makedate(),
                         'user': ui.username(),
                         }
-                    store.create(prec, sucs, 0, meta)
-                    cnt += 1
+                    try:
+                        store.create(prec, sucs, 0, meta)
+                        cnt += 1
+                    except ValueError:
+                        repo.ui.write_err("invalid old marker line: %s"
+                                          % (line))
+                        err += 1
             finally:
                 f.close()
             util.unlink(repo.join('obsolete-relations'))
                 try:
                     store.create(bin(oldobject), [bin(n) for n in oldsubjects],
                                  0, meta)
+                    cnt += 1
                 except ValueError:
                     repo.ui.write_err("invalid marker %s -> %s\n"
                                  % (oldobject, oldsubjects))
                     err += 1
-                cnt += 1
             util.unlink(repo.sjoin('obsoletemarkers'))
     finally:
         del repo._importoldobsolete