[PATCH] Fix error of 'hg bfverify -c'

Dongsheng Song dongsheng.song at gmail.com
Tue May 4 22:47:26 CDT 2010


Hi,

This patch fix error of 'hg bfverify -c', like:

C:\var\vcs\hg\test>hg bfverify -c
searching 1 changesets for big files
changeset 2:a6f40271d8bb: TortoiseGit-1.4.4.0-32bit.msi: contents differ

(C:/var/vcs/hg/bfiles-store\TortoiseGit-1.4.4.0-32bit.msi\3a09f68ef387d90dc77d
47b10b718622f1d6fb0d:
  expected hash 3a09f68ef387d90dc77d47b10b718622f1d6fb0d,
  but got 40a70fbe2be7a17afedcb6ed162209577e09f32f)
changeset 2:a6f40271d8bb: tortoisehg-1.0.2-hg-1.5.2-x86.msi: contents differ

(C:/var/vcs/hg/bfiles-store\tortoisehg-1.0.2-hg-1.5.2-x86.msi\70331a6e1dbfabd8
35d607db0c144a9f8ff1d4b9:
  expected hash 70331a6e1dbfabd835d607db0c144a9f8ff1d4b9,
  but got 0a2c8b1155163fd818e344693d9fbe2562d4398c)
verified contents of 2 revisions of 2 big files

=== (+4,-4) bfiles.py ===
@@ -661,7 +661,7 @@
             # block hashes in the standin file, but that could complicate
             # things considerably!
             ui.debug('reading %s to check if it has really changed\n' %
filename)
-            infile = repo.wopener(filename, 'r')
+            infile = repo.wopener(filename, 'rb')
             hash = _hashfile(infile)

             #saved_hash = _read_standin(repo, _standin(filename))
@@ -830,7 +830,7 @@
         # This interface isn't used internally.  It's here for the
         # convenience of anyone converting an existing repository to a
         # Mercurial+bfiles repository.
-        infile = repo.wopener(filename, 'r')
+        infile = repo.wopener(filename, 'rb')
     pending_dir = repo.join(os.path.join('bfiles', 'pending', filename))
     util.makedirs(pending_dir)
     previous = os.listdir(pending_dir)
@@ -1274,7 +1274,7 @@
         store_path = os.path.join(self.url, filename, expect_hash)
         verified.add(key)
         try:
-            infile = open(store_path, 'r')
+            infile = open(store_path, 'rb')
         except IOError, err:
             self.ui.warn(
                 _('changeset %s: %s missing\n'

You can pull my changes from http://bitbucket.org/dongsheng/hg-bfiles/ .

Regards,
Dongsheng
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20100505/c61d8393/attachment.htm>


More information about the Mercurial-devel mailing list