Patchwork [2,of,4,V2] hghave: add a check about whitelisted filesystem that supports hardlink

login
register
mail settings
Submitter Jun Wu
Date March 22, 2017, 2 a.m.
Message ID <fef923fbdbaece1d3ea2.1490148054@localhost.localdomain>
Download mbox | patch
Permalink /patch/19543/
State Accepted
Headers show

Comments

Jun Wu - March 22, 2017, 2 a.m.
# HG changeset patch
# User Jun Wu <quark@fb.com>
# Date 1489307180 28800
#      Sun Mar 12 00:26:20 2017 -0800
# Node ID fef923fbdbaece1d3ea237f96088e5086ee6367c
# Parent  8891617ca43282810a8e758e53d6968f8138f0ca
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r fef923fbdbae
hghave: add a check about whitelisted filesystem that supports hardlink

This is needed for the test added by the next patch.

Patch

diff --git a/tests/hghave.py b/tests/hghave.py
--- a/tests/hghave.py
+++ b/tests/hghave.py
@@ -347,4 +347,10 @@  def has_hardlink():
         os.unlink(fn)
 
+@check("hardlink-whitelisted", "hardlinks on whitelisted filesystems")
+def has_hardlink_whitelisted():
+    from mercurial import osutil, util
+    fstype = getattr(osutil, 'getfstype', lambda x: None)('.')
+    return fstype in util._hardlinkfswhitelist
+
 @check("rmcwd", "can remove current working directory")
 def has_rmcwd():