Submitter | Jun Wu |
---|---|
Date | March 23, 2017, 7:07 p.m. |
Message ID | <235f1212559d03f115e2.1490296064@localhost.localdomain> |
Download | mbox | patch |
Permalink | /patch/19613/ |
State | Accepted |
Headers | show |
Comments
> On Mar 23, 2017, at 3:07 PM, Jun Wu <quark@fb.com> wrote: > > # HG changeset patch > # User Jun Wu <quark@fb.com> > # Date 1490295525 25200 > # Thu Mar 23 11:58:45 2017 -0700 > # Node ID 235f1212559d03f115e21992b5725a7dc7787632 > # Parent 2c02bb7fd7fc1212029dc903527e35a9efb7dbe1 > # Available At https://bitbucket.org/quark-zju/hg-draft > # hg pull https://bitbucket.org/quark-zju/hg-draft -r 235f1212559d > util: add a getfstype method Queued these, thanks > > The util version is a thin wrapper of the osutil version, which is not > always available. > > diff --git a/mercurial/util.py b/mercurial/util.py > --- a/mercurial/util.py > +++ b/mercurial/util.py > @@ -1368,4 +1368,11 @@ def fspath(name, root): > return ''.join(result) > > +def getfstype(dirpath): > + '''Get the filesystem type name from a directory (best-effort) > + > + Returns None if we are unsure, or errors like ENOENT, EPERM happen. > + ''' > + return getattr(osutil, 'getfstype', lambda x: None)(dirpath) > + > def checknlink(testfile): > '''check whether hardlink count reporting works properly''' > _______________________________________________ > Mercurial-devel mailing list > Mercurial-devel@mercurial-scm.org > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Patch
diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -1368,4 +1368,11 @@ def fspath(name, root): return ''.join(result) +def getfstype(dirpath): + '''Get the filesystem type name from a directory (best-effort) + + Returns None if we are unsure, or errors like ENOENT, EPERM happen. + ''' + return getattr(osutil, 'getfstype', lambda x: None)(dirpath) + def checknlink(testfile): '''check whether hardlink count reporting works properly'''