Commits

Jan Willems committed c929807

Added hg_move command to the API.

Comments (0)

Files changed (3)

  hg diff
  hg version
  hg clone
+ hg move
 
 You also have access to the configuration (config, configbool,
 configlist) just as in the internal Mercurial API. The repository 
         """Remove a file from the repo"""
         self.hg_command("remove", filepath)
 
+    def hg_move(self, source, destination):
+        """Move a file in the repo."""
+        self.hg_command("move", source, destination)
+
     def hg_update(self, reference, clean=False):
         """Update to the revision identified by reference"""
         cmd = ["update", str(reference)]

hgapi/testhgapi.py

         diffs = self.repo.hg_diff('default', filenames=['file.txt'])
         self.assertEquals(len(diffs), 0)
 
+    def test_270_Move(self):
+        with open("test/source.txt", "w") as out:
+            out.write("stuff")
+        self.repo.hg_add("source.txt")
+        self.repo.hg_commit("Source is committed.")
+        self.repo.hg_move("source.txt", "destination.txt")
+        # get diffs and check proper move
+        diffs = self.repo.hg_diff()
+        self.assertTrue(diffs[0]['filename'] == 'destination.txt')
+        self.assertTrue(diffs[1]['filename'] == 'source.txt')
+
     def test_400_version(self):
         self.assertNotEquals(hgapi.hg_version(), "")