Work around Mercurial issue618 in Arch backend.
authorW. Trevor King <wking@drexel.edu>
Tue, 19 Jan 2010 13:45:04 +0000 (08:45 -0500)
committerW. Trevor King <wking@drexel.edu>
Tue, 19 Jan 2010 13:45:04 +0000 (08:45 -0500)
Also add some NotImplementedErrors for clearer diagnostics.

libbe/storage/vcs/arch.py

index f9ae32bc33bcf9fa20eb24b39e4cb36e9d913eba..b7f4d369c0f2da2d32a8a66db294619f9b85d584 100644 (file)
@@ -27,7 +27,7 @@ import os
 import re
 import shutil
 import sys
-import time
+import time # work around http://mercurial.selenic.com/bts/issue618
 
 import libbe
 import libbe.ui.util.user
@@ -68,6 +68,7 @@ class Arch(base.VCS):
         self.versioned = True
         self.interspersed_vcs_files = True
         self.paranoid = False
+        self.__updated = [] # work around http://mercurial.selenic.com/bts/issue618
 
     def _vcs_version(self):
         status,output,error = self._u_invoke_client('--version')
@@ -288,7 +289,7 @@ class Arch(base.VCS):
             shutil.rmtree(arch_ids)
 
     def _vcs_update(self, path):
-        pass
+        self.__updated.append(path) # work around http://mercurial.selenic.com/bts/issue618
 
     def _vcs_is_versioned(self, path):
         if '.arch-ids' in path:
@@ -300,16 +301,28 @@ class Arch(base.VCS):
             return base.VCS._vcs_get_file_contents(self, path, revision)
         else:
             status,output,error = \
-                self._invoke_client('file-find', path, revision)
+                self._invoke_client(
+                'file-find', '--unescaped', path, revision)
             relpath = output.rstrip('\n')
             return base.VCS._vcs_get_file_contents(self, relpath)
 
+    def _vcs_path(self, id, revision):
+        raise NotImplementedError
+
     def _vcs_commit(self, commitfile, allow_empty=False):
         if allow_empty == False:
             # arch applies empty commits without complaining, so check first
             status,output,error = self._u_invoke_client('changes',expect=(0,1))
             if status == 0:
-                raise base.EmptyCommit()
+                # work around http://mercurial.selenic.com/bts/issue618
+                time.sleep(1)
+                for path in self.__updated:
+                    os.utime(os.path.join(self.repo, path), None)
+                self.__updated = []
+                status,output,error = self._u_invoke_client('changes',expect=(0,1))
+                if status == 0:
+                # end work around
+                    raise base.EmptyCommit()
         summary,body = self._u_parse_commitfile(commitfile)
         args = ['commit', '--summary', summary]
         if body != None:
@@ -342,6 +355,9 @@ class Arch(base.VCS):
             return None
         return '%s--%s' % (self._archive_project_name(), log)
 
+    def _vcs_changed(self, revision):
+        raise NotImplementedError
+
 \f
 if libbe.TESTING == True:
     base.make_vcs_testcase_subclasses(Arch, sys.modules[__name__])