Patchwork [1,of,2,STABLE] infinitepush: ensure fileindex bookmarks use '/' separators (issue5840)

mail settings
Submitter Matt Harbison
Date April 24, 2018, 3:59 a.m.
Message ID <8074f17885f9d768682c.1524542360@Envy>
Download mbox | patch
Permalink /patch/31216/
State Accepted
Headers show


Matt Harbison - April 24, 2018, 3:59 a.m.
# HG changeset patch
# User Matt Harbison <>
# Date 1524540172 14400
#      Mon Apr 23 23:22:52 2018 -0400
# Branch stable
# Node ID 8074f17885f9d768682cbfc11f294aba9908749d
# Parent  856f381ad74b78f5188a8e12648e9f7d38097c46
infinitepush: ensure fileindex bookmarks use '/' separators (issue5840)

After loading up with status messages, I noticed that the subsequent matcher was
rejecting 'scratch\mybranch' on Windows.  No bookmarks were reported back, and
the tests subsequently failed.  I did a search for 'match', and nothing else
looks like it needs to be fixed up, but someone who understands this code should
also take a look.

I also tried setting `infinitepush.branchpattern=re:scratch\\.*` in without this change, but that didn't work.  Still,
should we ban '\' in these bookmarks to avoid confusion?  I thought I saw code
that sandwiches a pattern between 're:^' and '.*', so perhaps regex characters
will need special care?

I also noticed comments in externalbundlestore.{read,write} that it won't work
on Windows because of opening an open file.  But I don't see a test failure, so
this may lack test coverage.


diff --git a/hgext/infinitepush/ b/hgext/infinitepush/
--- a/hgext/infinitepush/
+++ b/hgext/infinitepush/
@@ -15,6 +15,8 @@  from __future__ import absolute_import
 import os
+from mercurial import util
 from mercurial.utils import stringutil
 from . import indexapi
@@ -82,6 +84,7 @@  class fileindexapi(indexapi.indexapi):
         for dirpath, _, books in self._repo.vfs.walk(self._bookmarkmap):
             for book in books:
                 bookmark = os.path.join(dirpath, book)[prefixlen:]
+                bookmark = util.pconvert(bookmark)
                 if not matcher(bookmark):
                 yield bookmark, self._read(os.path.join(dirpath, book))