예제 #1
0
파일: dirstate.py 프로젝트: CS76/ipo-galaxy
 def pathto(self, f, cwd=None):
     if cwd is None:
         cwd = self.getcwd()
     path = util.pathto(self._root, cwd, f)
     if self._slash:
         return util.pconvert(path)
     return path
예제 #2
0
 def pathto(self, f, cwd=None):
     if cwd is None:
         cwd = self.getcwd()
     path = util.pathto(self._root, cwd, f)
     if self._slash:
         return util.pconvert(path)
     return path
예제 #3
0
파일: patch.py 프로젝트: c0ns0le/cygwin
def updatedir(ui, repo, patches):
    '''Update dirstate after patch application according to metadata'''
    if not patches:
        return
    copies = []
    removes = {}
    cfiles = patches.keys()
    cwd = repo.getcwd()
    if cwd:
        cfiles = [util.pathto(repo.root, cwd, f) for f in patches.keys()]
    for f in patches:
        ctype, gp = patches[f]
        if ctype == 'RENAME':
            copies.append((gp.oldpath, gp.path))
            removes[gp.oldpath] = 1
        elif ctype == 'COPY':
            copies.append((gp.oldpath, gp.path))
        elif ctype == 'DELETE':
            removes[gp.path] = 1
    for src, dst in copies:
        repo.copy(src, dst)
    removes = removes.keys()
    if removes:
        removes.sort()
        repo.remove(removes, True)
    for f in patches:
        ctype, gp = patches[f]
        if gp and gp.mode:
            flags = ''
            if gp.mode & 0100:
                flags = 'x'
            elif gp.mode & 020000:
                flags = 'l'
            dst = os.path.join(repo.root, gp.path)
            # patch won't create empty files
            if ctype == 'ADD' and not os.path.exists(dst):
                repo.wwrite(gp.path, '', flags)
            else:
                util.set_flags(dst, 'l' in flags, 'x' in flags)
    cmdutil.addremove(repo, cfiles)
    files = patches.keys()
    files.extend([r for r in removes if r not in files])
    files.sort()

    return files
예제 #4
0
def updatedir(ui, repo, patches):
    '''Update dirstate after patch application according to metadata'''
    if not patches:
        return
    copies = []
    removes = {}
    cfiles = patches.keys()
    cwd = repo.getcwd()
    if cwd:
        cfiles = [util.pathto(repo.root, cwd, f) for f in patches.keys()]
    for f in patches:
        ctype, gp = patches[f]
        if ctype == 'RENAME':
            copies.append((gp.oldpath, gp.path))
            removes[gp.oldpath] = 1
        elif ctype == 'COPY':
            copies.append((gp.oldpath, gp.path))
        elif ctype == 'DELETE':
            removes[gp.path] = 1
    for src, dst in copies:
        repo.copy(src, dst)
    removes = removes.keys()
    if removes:
        removes.sort()
        repo.remove(removes, True)
    for f in patches:
        ctype, gp = patches[f]
        if gp and gp.mode:
            flags = ''
            if gp.mode & 0100:
                flags = 'x'
            elif gp.mode & 020000:
                flags = 'l'
            dst = os.path.join(repo.root, gp.path)
            # patch won't create empty files
            if ctype == 'ADD' and not os.path.exists(dst):
                repo.wwrite(gp.path, '', flags)
            else:
                util.set_flags(dst, 'l' in flags, 'x' in flags)
    cmdutil.addremove(repo, cfiles)
    files = patches.keys()
    files.extend([r for r in removes if r not in files])
    files.sort()

    return files
예제 #5
0
def updatedir(ui, repo, patches, similarity=0):
    '''Update dirstate after patch application according to metadata'''
    if not patches:
        return []
    copies = []
    removes = set()
    cfiles = patches.keys()
    cwd = repo.getcwd()
    if cwd:
        cfiles = [util.pathto(repo.root, cwd, f) for f in patches.keys()]
    for f in patches:
        gp = patches[f]
        if not gp:
            continue
        if gp.op == 'RENAME':
            copies.append((gp.oldpath, gp.path))
            removes.add(gp.oldpath)
        elif gp.op == 'COPY':
            copies.append((gp.oldpath, gp.path))
        elif gp.op == 'DELETE':
            removes.add(gp.path)

    wctx = repo[None]
    for src, dst in copies:
        dirstatecopy(ui, repo, wctx, src, dst, cwd=cwd)
    if (not similarity) and removes:
        wctx.remove(sorted(removes), True)

    for f in patches:
        gp = patches[f]
        if gp and gp.mode:
            islink, isexec = gp.mode
            dst = repo.wjoin(gp.path)
            # patch won't create empty files
            if gp.op == 'ADD' and not os.path.lexists(dst):
                flags = (isexec and 'x' or '') + (islink and 'l' or '')
                repo.wwrite(gp.path, '', flags)
            util.setflags(dst, islink, isexec)
    addremove(repo, cfiles, similarity=similarity)
    files = patches.keys()
    files.extend([r for r in removes if r not in files])
    return sorted(files)
예제 #6
0
def updatedir(ui, repo, patches, similarity=0):
    '''Update dirstate after patch application according to metadata'''
    if not patches:
        return
    copies = []
    removes = set()
    cfiles = patches.keys()
    cwd = repo.getcwd()
    if cwd:
        cfiles = [util.pathto(repo.root, cwd, f) for f in patches.keys()]
    for f in patches:
        gp = patches[f]
        if not gp:
            continue
        if gp.op == 'RENAME':
            copies.append((gp.oldpath, gp.path))
            removes.add(gp.oldpath)
        elif gp.op == 'COPY':
            copies.append((gp.oldpath, gp.path))
        elif gp.op == 'DELETE':
            removes.add(gp.path)

    wctx = repo[None]
    for src, dst in copies:
        dirstatecopy(ui, repo, wctx, src, dst, cwd=cwd)
    if (not similarity) and removes:
        wctx.remove(sorted(removes), True)

    for f in patches:
        gp = patches[f]
        if gp and gp.mode:
            islink, isexec = gp.mode
            dst = repo.wjoin(gp.path)
            # patch won't create empty files
            if gp.op == 'ADD' and not os.path.lexists(dst):
                flags = (isexec and 'x' or '') + (islink and 'l' or '')
                repo.wwrite(gp.path, '', flags)
            util.set_flags(dst, islink, isexec)
    addremove(repo, cfiles, similarity=similarity)
    files = patches.keys()
    files.extend([r for r in removes if r not in files])
    return sorted(files)
예제 #7
0
def updatedir(ui, repo, patches, similarity=0):
    """Update dirstate after patch application according to metadata"""
    if not patches:
        return
    copies = []
    removes = {}
    cfiles = patches.keys()
    cwd = repo.getcwd()
    if cwd:
        cfiles = [util.pathto(repo.root, cwd, f) for f in patches.keys()]
    for f in patches:
        gp = patches[f]
        if not gp:
            continue
        if gp.op == "RENAME":
            copies.append((gp.oldpath, gp.path))
            removes[gp.oldpath] = 1
        elif gp.op == "COPY":
            copies.append((gp.oldpath, gp.path))
        elif gp.op == "DELETE":
            removes[gp.path] = 1
    for src, dst in copies:
        repo.copy(src, dst)
    removes = removes.keys()
    if (not similarity) and removes:
        repo.remove(util.sort(removes), True)
    for f in patches:
        gp = patches[f]
        if gp and gp.mode:
            islink, isexec = gp.mode
            dst = repo.wjoin(gp.path)
            # patch won't create empty files
            if gp.op == "ADD" and not os.path.exists(dst):
                flags = (isexec and "x" or "") + (islink and "l" or "")
                repo.wwrite(gp.path, "", flags)
            elif gp.op != "DELETE":
                util.set_flags(dst, islink, isexec)
    cmdutil.addremove(repo, cfiles, similarity=similarity)
    files = patches.keys()
    files.extend([r for r in removes if r not in files])
    return util.sort(files)
예제 #8
0
파일: hg.py 프로젝트: pierfort123/mercurial
def verify(repo):
    """verify the consistency of a repository"""
    ret = verifymod.verify(repo)

    # Broken subrepo references in hidden csets don't seem worth worrying about,
    # since they can't be pushed/pulled, and --hidden can be used if they are a
    # concern.

    # pathto() is needed for -R case
    revs = repo.revs("filelog(%s)", util.pathto(repo.root, repo.getcwd(), ".hgsubstate"))

    if revs:
        repo.ui.status(_("checking subrepo links\n"))
        for rev in revs:
            ctx = repo[rev]
            try:
                for subpath in ctx.substate:
                    ret = ctx.sub(subpath).verify() or ret
            except Exception:
                repo.ui.warn(_(".hgsubstate is corrupt in revision %s\n") % node.short(ctx.node()))

    return ret
예제 #9
0
def verify(repo):
    """verify the consistency of a repository"""
    ret = verifymod.verify(repo)

    # Broken subrepo references in hidden csets don't seem worth worrying about,
    # since they can't be pushed/pulled, and --hidden can be used if they are a
    # concern.

    # pathto() is needed for -R case
    revs = repo.revs("filelog(%s)",
                     util.pathto(repo.root, repo.getcwd(), '.hgsubstate'))

    if revs:
        repo.ui.status(_('checking subrepo links\n'))
        for rev in revs:
            ctx = repo[rev]
            try:
                for subpath in ctx.substate:
                    ret = ctx.sub(subpath).verify() or ret
            except Exception:
                repo.ui.warn(_('.hgsubstate is corrupt in revision %s\n') %
                             node.short(ctx.node()))

    return ret
예제 #10
0
 def rel(self, f):
     '''Convert repo path back to path that is relative to cwd of matcher.'''
     return util.pathto(self._root, self._cwd, f)
예제 #11
0
 def rel(self, f):
     return util.pathto(self._root, self._cwd, f)
예제 #12
0
파일: match.py 프로젝트: rybesh/mysite-lib
 def rel(self, f):
     return util.pathto(self._root, self._cwd, f)
예제 #13
0
 def rel(self, f):
     '''Convert repo path back to path that is relative to cwd of matcher.'''
     return util.pathto(self._root, self._cwd, f)