Commits

Yuki KODAMA committed 0a54ffb

add code for saving applied patches

Comments (0)

Files changed (1)

 
     ui.debug('before: %s\n' % series)
 
+    # unapply all applied patches
+    top = None
+    if len(repo.mq.applied) > 0:
+        id, top = str(repo.mq.applied[-1]).split(':')
+        ui.debug('top: %s\n' % top)
+        repo.mq.pop(repo, None, False, True, True)
+    else:
+        ui.debug('top: no patches applied\n')
+
     # arrangement of patch order
     if len(args) == 2:
         try:
         fp.close()
 
     # flush modifies to series file
-#    write_list(repo.mq.full_series, repo.mq.series_path)
+    write_list(repo.mq.full_series, repo.mq.series_path)
+
+    # apply all unapplied patches
+    if top:
+        repo.mq.push(repo, top)
+    else:
+        repo.mq.push(repo, None, False, False, None, True)
 
 cmdtable = {
     'qswap': (qswap, [