pq: Don't fail commit if the series file is empty on the source branch
authorGuido Günther <agx@sigxcpu.org>
Tue, 14 Oct 2014 17:18:20 +0000 (19:18 +0200)
committerGuido Günther <agx@sigxcpu.org>
Tue, 14 Oct 2014 19:52:22 +0000 (21:52 +0200)
gbp/scripts/pq.py

index d9f49d4..e78f92c 100755 (executable)
@@ -116,8 +116,13 @@ def commit_patches(repo, branch, patches, options):
         return ([], [])
 
     vfs = gbp.git.vfs.GitVfs(repo, branch)
-    oldseries = vfs.open('debian/patches/series')
-    oldpatches = [ p.strip() for p in oldseries.readlines() ]
+    try:
+        oldseries = vfs.open('debian/patches/series')
+        oldpatches = [ p.strip() for p in oldseries.readlines() ]
+        oldseries.close()
+    except IOError:
+        # No series file yet
+        oldpatches = []
     newpatches = [ p[len(PATCH_DIR):] for p in patches ]
 
     # FIXME: handle case were only the contents of the patches changed