Submitter | Jun Wu |
---|---|
Date | March 22, 2017, 2 a.m. |
Message ID | <ea4573691618ea1937cf.1490148056@localhost.localdomain> |
Download | mbox | patch |
Permalink | /patch/19542/ |
State | Accepted |
Headers | show |
Comments
On Tue, 21 Mar 2017 19:00:56 -0700, Jun Wu wrote: > # HG changeset patch > # User Jun Wu <quark@fb.com> > # Date 1489311257 28800 > # Sun Mar 12 01:34:17 2017 -0800 > # Node ID ea4573691618ea1937cfe0c03c6caa4693b64b05 > # Parent e960baabf0da65e84e99466d4be9acaa4b9b91b2 > # Available At https://bitbucket.org/quark-zju/hg-draft > # hg pull https://bitbucket.org/quark-zju/hg-draft -r ea4573691618 > debugfsinfo: print fstype information These generally look good. Queued, thanks. > diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py > --- a/mercurial/debugcommands.py > +++ b/mercurial/debugcommands.py > @@ -791,4 +791,8 @@ def debugfsinfo(ui, path="."): > util.writefile('.debugfsinfo', '') > ui.write(('exec: %s\n') % (util.checkexec(path) and 'yes' or 'no')) > + from . import osutil Is there an import cycle? > + if util.safehasattr(osutil, 'getfstype'): > + fstype = osutil.getfstype('.') > + ui.write(('fstype: %s\n') % (fstype or '(unknown)')) Let's add util.getfstype() so we don't have to test the existence of getfstype(). It should be okay to print '(unknown)' if unsupported.
On Thu, Mar 23, 2017 at 11:34:41PM +0900, Yuya Nishihara wrote: > On Tue, 21 Mar 2017 19:00:56 -0700, Jun Wu wrote: > > # HG changeset patch > > # User Jun Wu <quark@fb.com> > > # Date 1489311257 28800 > > # Sun Mar 12 01:34:17 2017 -0800 > > # Node ID ea4573691618ea1937cfe0c03c6caa4693b64b05 > > # Parent e960baabf0da65e84e99466d4be9acaa4b9b91b2 > > # Available At https://bitbucket.org/quark-zju/hg-draft > > # hg pull https://bitbucket.org/quark-zju/hg-draft -r ea4573691618 > > debugfsinfo: print fstype information > > These generally look good. Queued, thanks. +1. Many thanks to Jun for sticking with this long enough to find the safe solution. :) > > > diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py > > --- a/mercurial/debugcommands.py > > +++ b/mercurial/debugcommands.py > > @@ -791,4 +791,8 @@ def debugfsinfo(ui, path="."): > > util.writefile('.debugfsinfo', '') > > ui.write(('exec: %s\n') % (util.checkexec(path) and 'yes' or 'no')) > > + from . import osutil > > Is there an import cycle? > > > + if util.safehasattr(osutil, 'getfstype'): > > + fstype = osutil.getfstype('.') > > + ui.write(('fstype: %s\n') % (fstype or '(unknown)')) > > Let's add util.getfstype() so we don't have to test the existence of > getfstype(). It should be okay to print '(unknown)' if unsupported. > _______________________________________________ > Mercurial-devel mailing list > Mercurial-devel@mercurial-scm.org > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Excerpts from Yuya Nishihara's message of 2017-03-23 23:34:41 +0900: > On Tue, 21 Mar 2017 19:00:56 -0700, Jun Wu wrote: > > # HG changeset patch > > # User Jun Wu <quark@fb.com> > > # Date 1489311257 28800 > > # Sun Mar 12 01:34:17 2017 -0800 > > # Node ID ea4573691618ea1937cfe0c03c6caa4693b64b05 > > # Parent e960baabf0da65e84e99466d4be9acaa4b9b91b2 > > # Available At https://bitbucket.org/quark-zju/hg-draft > > # hg pull https://bitbucket.org/quark-zju/hg-draft -r ea4573691618 > > debugfsinfo: print fstype information > > These generally look good. Queued, thanks. > > > diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py > > --- a/mercurial/debugcommands.py > > +++ b/mercurial/debugcommands.py > > @@ -791,4 +791,8 @@ def debugfsinfo(ui, path="."): > > util.writefile('.debugfsinfo', '') > > ui.write(('exec: %s\n') % (util.checkexec(path) and 'yes' or 'no')) > > + from . import osutil > > Is there an import cycle? Probably no. But "from . import osutil" is also in "debuginstall" so I assumed it's safer to not import it directly. > > > + if util.safehasattr(osutil, 'getfstype'): > > + fstype = osutil.getfstype('.') > > + ui.write(('fstype: %s\n') % (fstype or '(unknown)')) > > Let's add util.getfstype() so we don't have to test the existence of > getfstype(). It should be okay to print '(unknown)' if unsupported. Good idea!
Patch
diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py --- a/mercurial/debugcommands.py +++ b/mercurial/debugcommands.py @@ -791,4 +791,8 @@ def debugfsinfo(ui, path="."): util.writefile('.debugfsinfo', '') ui.write(('exec: %s\n') % (util.checkexec(path) and 'yes' or 'no')) + from . import osutil + if util.safehasattr(osutil, 'getfstype'): + fstype = osutil.getfstype('.') + ui.write(('fstype: %s\n') % (fstype or '(unknown)')) ui.write(('symlink: %s\n') % (util.checklink(path) and 'yes' or 'no')) ui.write(('hardlink: %s\n') % (util.checknlink(path) and 'yes' or 'no'))