[PATCH 3/3] After (external) merge is complete, give user option to delete other file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Raman Gupta <raman@xxxxxxxxxxxxxxx>

---
 plugins/merge-conf/merge-conf.py |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/plugins/merge-conf/merge-conf.py b/plugins/merge-conf/merge-conf.py
index 201efac..34b662b 100644
--- a/plugins/merge-conf/merge-conf.py
+++ b/plugins/merge-conf/merge-conf.py
@@ -85,6 +85,21 @@ def posttrans_hook(conduit):
                     else:
                         mergeConfFiles(tsmem.po.name, fn, False, conduit, has_prog)
 
+def mergeComplete(noreplace, other_file):
+    while True:
+        sys.stdout.write("""\nExternal merge complete, delete "%s"? (y/n) """ % other_file)
+        delete = sys.stdin.readline().strip()
+
+        if delete == "y":
+            os.remove(other_file)
+            print """"%s" deleted.""" % other_file
+            break
+        elif delete == "n":
+            print """Keeping file "%s".""" % other_file
+            break
+        else:
+            print "Unknown answer, please try again"
+
 def mergeConfFiles(pkg, fn, noreplace, conduit, has_prog):
     if noreplace:
         local_file = fn
@@ -161,9 +176,11 @@ def mergeConfFiles(pkg, fn, noreplace, conduit, has_prog):
             print "Choosing RPM's default action."
         elif answer == "m" and has_prog["meld"]:
             os.system("""meld '%s' '%s'""" % (other_file, final_file))
+            mergeComplete(noreplace, other_file)
             break
         elif answer == "v" and has_prog["vimdiff"]:
             os.system("""vimdiff '%s' '%s'""" % (other_file, final_file))
+            mergeComplete(noreplace, other_file)
             break
         else:
             print "Unknown answer, please try again"
-- 
1.7.4.4

_______________________________________________
Yum mailing list
Yum@xxxxxxxxxxxxxxxxx
http://lists.baseurl.org/mailman/listinfo/yum


[Index of Archives]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux