Пример #1
0
    def test_apply_next(self):
        patch1 = Patch("p1.patch")
        patch2 = Patch("p2.patch")

        test_dir = self.data_dir + "test2"

        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"
            patches_dir = tmp_test_dir + "patches"

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

            push = Push(tmp_test_dir.get_name(), pc_dir.get_name(),
                        patches_dir.get_name())
            self.assertEqual(None, push.db.top_patch())

            push.apply_next_patch(quiet=True)
            self.assertEqual(patch1, push.db.top_patch())

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

            push.apply_next_patch(quiet=True)
            self.assertEqual(patch2, push.db.top_patch())

            self.assertTrue(f1.exists())
            self.assertTrue(f2.exists())
Пример #2
0
    def test_apply_next(self):
        patch1 = Patch("p1.patch")
        patch2 = Patch("p2.patch")

        test_dir = self.data_dir + "test2"

        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"
            patches_dir = tmp_test_dir + "patches"

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

            push = Push(tmp_test_dir.get_name(), pc_dir.get_name(),
                        patches_dir.get_name())
            self.assertEquals(None, push.db.top_patch())

            push.apply_next_patch(quiet=True)
            self.assertEquals(patch1, push.db.top_patch())

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

            push.apply_next_patch(quiet=True)
            self.assertEquals(patch2, push.db.top_patch())

            self.assertTrue(f1.exists())
            self.assertTrue(f2.exists())
Пример #3
0
    def run(self, args):
        push = Push(self.get_cwd(), self.get_pc_dir(), self.get_patches_dir())
        push.applying_patch.connect(self.applying_patch)
        push.applied.connect(self.applied)
        push.applied_empty_patch.connect(self.applied_empty_patch)

        if args.all:
            push.apply_all(args.force)
        elif args.patch:
            push.apply_patch(args.patch, args.force)
        else:
            push.apply_next_patch(args.force)
Пример #4
0
    def run(self, options, args):
        push = Push(self.get_cwd(), self.get_pc_dir(), self.get_patches_dir())
        push.applying_patch.connect(self.applying_patch)
        push.applied.connect(self.applied)
        push.applied_empty_patch.connect(self.applied_empty_patch)

        if options.all:
            push.apply_all(options.force)
        elif not args:
            push.apply_next_patch(options.force)
        else:
            push.apply_patch(args[0], options.force)
Пример #5
0
    def push(self):
        """ Apply next patch """

        from quilt.push import Push
        from quilt.error import NoPatchesInSeries, AllPatchesApplied

        push = Push(self.work_dir, os.path.join(self.work_dir, ".pc"),
                    self.patch_dir)
        try:
            push.apply_next_patch()
        except NoPatchesInSeries, e:
            print e
Пример #6
0
    def run(self, args):
        push = Push(self.get_cwd(), self.get_pc_dir(), self.get_patches_dir())
        push.applying_patch.connect(self.applying_patch)
        push.applied.connect(self.applied)
        push.applied_empty_patch.connect(self.applied_empty_patch)

        if args.all:
            push.apply_all(args.force)
        elif args.patch:
            push.apply_patch(args.patch, args.force)
        else:
            push.apply_next_patch(args.force)
Пример #7
0
 def test_force(self):
     with tmp_series() as [dir, series]:
         self._make_conflict(dir, series)
         series.save()
         cmd = Push(dir, quilt_pc=dir, quilt_patches=series.dirname)
         with six.assertRaisesRegex(
                     self, QuiltError, r"does not apply"), \
                 self._suppress_output():
             cmd.apply_next_patch(quiet=True)
         with six.assertRaisesRegex(self, QuiltError,
                     r"Applied patch.*needs refresh"), \
                 self._suppress_output():
             cmd.apply_next_patch(quiet=True, force=True)