[PATCH 1 of 2 STABLE] debugobsolete: catch ValueError that may be raised by obsstore.create

Pierre-Yves David pierre-yves.david at ens-lyon.org
Thu Aug 14 17:03:07 CDT 2014


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1408053423 25200
#      Thu Aug 14 14:57:03 2014 -0700
# Branch stable
# Node ID bc57cad7a920f3425bf0db6b68475a4c5e3c0436
# Parent  989c16c1b050a314e136675ca9ac73a90d13da2a
debugobsolete: catch ValueError that may be raised by obsstore.create

There is already of couple of error that obsstore.create can raise and we are
going to introduce a cycle check too.

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2336,13 +2336,16 @@ def debugobsolete(ui, repo, precursor=No
         succs = tuple(parsenodeid(succ) for succ in successors)
         l = repo.lock()
         try:
             tr = repo.transaction('debugobsolete')
             try:
-                repo.obsstore.create(tr, parsenodeid(precursor), succs,
-                                     opts['flags'], metadata)
-                tr.close()
+                try:
+                    repo.obsstore.create(tr, parsenodeid(precursor), succs,
+                                         opts['flags'], metadata)
+                    tr.close()
+                except ValueError, exc:
+                    raise util.Abort(_('bad obsmarker input: %s') % exc)
             finally:
                 tr.release()
         finally:
             l.release()
     else:


More information about the Mercurial-devel mailing list