windows: grp module not supported

On windows the grp module is not present, so we need to avoid importing it. This
means the shared group feature of remotefilelog is not supported on windows.
This commit is contained in:
Olivier Trempe 2016-05-20 08:08:57 -07:00
parent a1a32e5f37
commit abf6481106
2 changed files with 12 additions and 3 deletions

View File

@ -1,9 +1,12 @@
import errno, grp, os, shutil, time
import errno, os, shutil, stat, time
import shallowutil
from mercurial import util
from mercurial import error, util
from mercurial.i18n import _
from mercurial.node import bin, hex
if os.name != 'nt':
import grp
class basestore(object):
def __init__(self, repo, path, reponame, shared=False):
"""Creates a remotefilelog store object for the given repo name.
@ -40,6 +43,9 @@ class basestore(object):
groupname = self.ui.config("remotefilelog", "cachegroup")
if groupname:
if os.name == 'nt':
raise error.Abort(_('cachegroup option not'
' supported on Windows'))
gid = grp.getgrnam(groupname).gr_gid
if gid:
os.chown(path, os.getuid(), gid)

View File

@ -9,13 +9,16 @@ from mercurial.i18n import _
from mercurial.node import hex, bin
from mercurial import util, sshpeer, hg, error, util, wireproto, node, httppeer
from mercurial import scmutil
import os, socket, lz4, time, grp, io, struct
import os, socket, lz4, time, io, struct
import errno
import itertools
import constants, datapack, historypack, shallowutil
from shallowutil import readexactly, readunpack
if os.name != 'nt':
import grp
# Statistics for debugging
fetchcost = 0
fetches = 0