hgext/convert/common.py
branchstable
changeset 16190 9479c28a22bf
parent 16118 d554a3dcae5a
child 16265 7887b976650a
--- a/hgext/convert/common.py	Tue Feb 28 01:07:55 2012 +0200
+++ b/hgext/convert/common.py	Tue Feb 28 10:06:35 2012 +0100
@@ -385,8 +385,12 @@
                 raise
             return
         for i, line in enumerate(fp):
+            line = line.splitlines()[0].rstrip()
+            if not line:
+                # Ignore blank lines
+                continue
             try:
-                key, value = line.splitlines()[0].rstrip().rsplit(' ', 1)
+                key, value = line.rsplit(' ', 1)
             except ValueError:
                 raise util.Abort(
                     _('syntax error in %s(%d): key/value pair expected')
@@ -418,8 +422,12 @@
     try:
         fp = open(path, 'r')
         for i, line in enumerate(fp):
+            line = line.splitlines()[0].rstrip()
+            if not line:
+                # Ignore blank lines
+                continue
             try:
-                child, parents = line.splitlines()[0].rstrip().split(' ', 1)
+                child, parents = line.split(' ', 1)
                 parents = parents.replace(',', ' ').split()
             except ValueError:
                 raise util.Abort(_('syntax error in %s(%d): child parent1'