branching: merge with stable
authorPierre-Yves David <pierre-yves.david@octobus.net>
Sun, 24 Dec 2023 02:43:53 +0100
changeset 51278 6113221a1dea
parent 51276 03665fd8ccb9 (current diff)
parent 51277 d7155949535e (diff)
child 51281 8f1983318455
branching: merge with stable I need the fix to `generate-churning-bundle.py`.
--- a/mercurial/revlogutils/nodemap.py	Sat Dec 16 10:48:20 2023 -0800
+++ b/mercurial/revlogutils/nodemap.py	Sun Dec 24 02:43:53 2023 +0100
@@ -206,11 +206,11 @@
                 fd.write(data)
                 if feed_data:
                     if use_mmap:
+                        fd.flush()
+                        new_data = util.buffer(util.mmapread(fd, new_length))
+                    else:
                         fd.seek(0)
                         new_data = fd.read(new_length)
-                    else:
-                        fd.flush()
-                        new_data = util.buffer(util.mmapread(fd, new_length))
             target_docket.data_length = new_length
             target_docket.data_unused = new_unused
 
--- a/tests/artifacts/scripts/generate-churning-bundle.py	Sat Dec 16 10:48:20 2023 -0800
+++ b/tests/artifacts/scripts/generate-churning-bundle.py	Sun Dec 24 02:43:53 2023 +0100
@@ -46,7 +46,7 @@
 
 def nextcontent(previous_content):
     """utility to produce a new file content from the previous one"""
-    return hashlib.md5(previous_content).hexdigest()
+    return hashlib.md5(previous_content).hexdigest().encode('ascii')
 
 
 def filecontent(iteridx, oldcontent):
@@ -57,9 +57,9 @@
 
     # initial call
     if iteridx is None:
-        current = ''
+        current = b''
     else:
-        current = str(iteridx)
+        current = b"%d" % iteridx
 
     for idx in range(NB_LINES):
         do_change_line = True
@@ -67,7 +67,7 @@
             do_change_line = not ((idx - iteridx) % OTHER_CHANGES)
 
         if do_change_line:
-            to_write = current + '\n'
+            to_write = current + b'\n'
             current = nextcontent(current)
         else:
             to_write = oldcontent[idx]
@@ -127,7 +127,7 @@
             data = bundle.read()
             digest = hashlib.md5(data).hexdigest()
         with open(target + '.md5', 'wb') as md5file:
-            md5file.write(digest + '\n')
+            md5file.write(digest.encode('ascii') + b'\n')
         if sys.stdout.isatty():
             print('bundle generated at "%s" md5: %s' % (target, digest))