[PATCH] clone on Windows: abort on reserved filenames (1st update)

Jesse Glick jesse.glick at sun.com
Thu Jun 26 19:25:25 CDT 2008


Adrian Buehlmann wrote:
> maybe we can add a config option which makes Mercurial yell if a user
> tries to push/commit a file with a horrid name like "aux" into a
> repo.

FWIW, for the NetBeans repositories we try to prevent the Windows 
pathname limit from getting exceeded using a hook on the server:

def forbid_long_path(ui, repo, hooktype, node, **kwargs):
     halt = False
     for rev in xrange(repo.changelog.rev(bin(node)), 
repo.changelog.count()):
         c = repo.changectx(rev)
         for f in c.files():
             if f not in c:
                 continue
             if len(c[f].path()) > 206 or 
len(repo.encodefn(c[f].path()).join((".hg/store/data/",".i"))) > 206:
                 if not halt:
                     ui.warn(_('The path of the file is too long, longer 
than 206 chars: %s\n') % c[f].path())
                 ui.warn(_('in %s: %s\n') % (short(c.node()), f))
                 halt = True
     return halt



More information about the Mercurial-devel mailing list