changeset 341:7653f80fd7a4 stable

obsolete: harden convertion from first format
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Fri, 06 Jul 2012 17:15:30 +0200
parents 37b543215187
children 9bbcd2746898
files hgext/obsolete.py
diffstat 1 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/obsolete.py	Fri Jul 06 16:32:53 2012 +0200
+++ b/hgext/obsolete.py	Fri Jul 06 17:15:30 2012 +0200
@@ -589,8 +589,13 @@
                         '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'))
@@ -623,11 +628,11 @@
                 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