Пример #1
0
def _pop(force=False):
    pop = Pop(os.getcwd(), pc_dir)
    try:
        pop.unapply_all(force)
    except QuiltError, e:
        print t.red('KO: Error applying patch:' + str(e))
        return -1
Пример #2
0
 def __init__(self, cwd, quilt_pc, quilt_patches):
     super(Delete, self).__init__(cwd)
     self.quilt_pc = Directory(quilt_pc)
     self.quilt_patches = Directory(quilt_patches)
     self.db = Db(quilt_pc)
     self.series = Series(quilt_patches)
     self.pop = Pop(cwd, quilt_pc)
Пример #3
0
    def test_apply_next(self):
        patch1 = Patch("p1.patch")
        patch2 = Patch("p2.patch")

        test_dir = self.data_dir + "test1"

        with TmpDirectory(dir=self.data_dir.get_name()) as tmp_dir:
            tmp_test_dir = tmp_dir + "test2"

            test_dir.copy(tmp_test_dir)

            pc_dir = tmp_test_dir + "pc"

            f1 = tmp_test_dir + File("f1")
            self.assertTrue(f1.exists())
            f2 = tmp_test_dir + File("f2")
            self.assertTrue(f2.exists())

            pop = Pop(tmp_test_dir.get_name(), pc_dir.get_name())
            self.assertEqual(patch2, pop.db.top_patch())

            pop.unapply_top_patch()
            self.assertEqual(patch1, pop.db.top_patch())

            self.assertTrue(f1.exists())
            self.assertFalse(f2.exists())

            pop.unapply_top_patch()
            self.assertEqual(None, pop.db.top_patch())

            self.assertFalse(f1.exists())
            self.assertFalse(f2.exists())
Пример #4
0
 def test_unrefreshed(self):
     with TmpDirectory() as dir:
         db = Db(dir.get_name())
         db.add_patch(Patch("unrefreshed.patch"))
         db.save()
         make_file(b"", db.dirname, "unrefreshed.patch~refresh")
         cmd = Pop(dir.get_name(), db.dirname)
         with six.assertRaisesRegex(self, QuiltError,
                 r"needs to be refreshed"):
             cmd.unapply_top_patch()
Пример #5
0
    def run(self, args):
        pop = Pop(os.getcwd(), self.get_pc_dir())
        pop.unapplying.connect(self.unapplying)
        pop.unapplied.connect(self.unapplied)
        pop.empty_patch.connect(self.empty_patch)

        if args.all:
            pop.unapply_all()
        elif args.patch:
            pop.unapply_patch(args.patch)
        else:
            pop.unapply_top_patch()
Пример #6
0
def _pop(force=False):
    pop = Pop(os.getcwd(), pc_dir)
    try:
        pop.unapply_all(force)
    except QuiltError as e:
        print(t.red('KO: Error applying patch:' + str(e)))
        return -1
    except UnknownPatch as e:
        print(t.red('KO: Error applying patch:' + str(e)))
        return -1
    print(t.green('OK: All Patches removed'))
    return 0