コード例 #1
0
ファイル: merge.py プロジェクト: jordigh/mercurial-crew
 def resolve(self, dfile, wctx, octx):
     if self[dfile] == 'r':
         return 0
     state, hash, lfile, afile, anode, ofile, flags = self._state[dfile]
     fcd = wctx[dfile]
     fco = octx[ofile]
     fca = self._repo.filectx(afile, fileid=anode)
     # "premerge" x flags
     flo = fco.flags()
     fla = fca.flags()
     if 'x' in flags + flo + fla and 'l' not in flags + flo + fla:
         if fca.node() == nullid:
             self._repo.ui.warn(_('warning: cannot merge flags for %s\n') %
                                afile)
         elif flags == fla:
             flags = flo
     # restore local
     f = self._repo.opener("merge/" + hash)
     self._repo.wwrite(dfile, f.read(), flags)
     f.close()
     r = filemerge.filemerge(self._repo, self._local, lfile, fcd, fco, fca)
     if r is None:
         # no real conflict
         del self._state[dfile]
     elif not r:
         self.mark(dfile, 'r')
     return r
コード例 #2
0
ファイル: merge.py プロジェクト: RayFerr000/PLTL
 def resolve(self, dfile, wctx, labels=None):
     """rerun merge process for file path `dfile`"""
     if self[dfile] == 'r':
         return 0
     stateentry = self._state[dfile]
     state, hash, lfile, afile, anode, ofile, onode, flags = stateentry
     octx = self._repo[self._other]
     fcd = wctx[dfile]
     fco = octx[ofile]
     fca = self._repo.filectx(afile, fileid=anode)
     # "premerge" x flags
     flo = fco.flags()
     fla = fca.flags()
     if 'x' in flags + flo + fla and 'l' not in flags + flo + fla:
         if fca.node() == nullid:
             self._repo.ui.warn(_('warning: cannot merge flags for %s\n') %
                                afile)
         elif flags == fla:
             flags = flo
     # restore local
     f = self._repo.vfs('merge/' + hash)
     self._repo.wwrite(dfile, f.read(), flags)
     f.close()
     r = filemerge.filemerge(self._repo, self._local, lfile, fcd, fco, fca,
                             labels=labels)
     if r is None:
         # no real conflict
         del self._state[dfile]
         self._dirty = True
     elif not r:
         self.mark(dfile, 'r')
     return r
コード例 #3
0
 def resolve(self, dfile, wctx, octx):
     if self[dfile] == 'r':
         return 0
     state, hash, lfile, afile, anode, ofile, flags = self._state[dfile]
     fcd = wctx[dfile]
     fco = octx[ofile]
     fca = self._repo.filectx(afile, fileid=anode)
     # "premerge" x flags
     flo = fco.flags()
     fla = fca.flags()
     if 'x' in flags + flo + fla and 'l' not in flags + flo + fla:
         if fca.node() == nullid:
             self._repo.ui.warn(
                 _('warning: cannot merge flags for %s\n') % afile)
         elif flags == fla:
             flags = flo
     # restore local
     f = self._repo.opener("merge/" + hash)
     self._repo.wwrite(dfile, f.read(), flags)
     f.close()
     r = filemerge.filemerge(self._repo, self._local, lfile, fcd, fco, fca)
     if r is None:
         # no real conflict
         del self._state[dfile]
     elif not r:
         self.mark(dfile, 'r')
     return r
コード例 #4
0
ファイル: merge.py プロジェクト: as/9front-work
 def resolve(self, dfile, wctx, octx):
     if self[dfile] == 'r':
         return 0
     state, hash, lfile, afile, anode, ofile, flags = self._state[dfile]
     f = self._repo.opener("merge/" + hash)
     self._repo.wwrite(dfile, f.read(), flags)
     fcd = wctx[dfile]
     fco = octx[ofile]
     fca = self._repo.filectx(afile, fileid=anode)
     r = filemerge.filemerge(self._repo, self._local, lfile, fcd, fco, fca)
     if not r:
         self.mark(dfile, 'r')
     return r
コード例 #5
0
ファイル: merge.py プロジェクト: helloandre/cr48
 def resolve(self, dfile, wctx, octx):
     if self[dfile] == 'r':
         return 0
     state, hash, lfile, afile, anode, ofile, flags = self._state[dfile]
     f = self._repo.opener("merge/" + hash)
     self._repo.wwrite(dfile, f.read(), flags)
     fcd = wctx[dfile]
     fco = octx[ofile]
     fca = self._repo.filectx(afile, fileid=anode)
     r = filemerge.filemerge(self._repo, self._local, lfile, fcd, fco, fca)
     if not r:
         self.mark(dfile, 'r')
     return r
コード例 #6
0
ファイル: merge.py プロジェクト: Pelonza/Learn2Mine-Main
 def resolve(self, dfile, wctx, octx):
     if self[dfile] == "r":
         return 0
     state, hash, lfile, afile, anode, ofile, flags = self._state[dfile]
     f = self._repo.opener("merge/" + hash)
     self._repo.wwrite(dfile, f.read(), flags)
     f.close()
     fcd = wctx[dfile]
     fco = octx[ofile]
     fca = self._repo.filectx(afile, fileid=anode)
     r = filemerge.filemerge(self._repo, self._local, lfile, fcd, fco, fca)
     if r is None:
         # no real conflict
         del self._state[dfile]
     elif not r:
         self.mark(dfile, "r")
     return r
コード例 #7
0
def applyupdates(repo, action, wctx, mctx):
    "apply the merge action list to the working directory"

    updated, merged, removed, unresolved = 0, 0, 0, 0
    action.sort()
    # prescan for copy/renames
    for a in action:
        f, m = a[:2]
        if m == 'm':  # merge
            f2, fd, flags, move = a[2:]
            if f != fd:
                repo.ui.debug(_("copying %s to %s\n") % (f, fd))
                repo.wwrite(fd, repo.wread(f), flags)

    audit_path = util.path_auditor(repo.root)

    for a in action:
        f, m = a[:2]
        if f and f[0] == "/":
            continue
        if m == "r":  # remove
            repo.ui.note(_("removing %s\n") % f)
            audit_path(f)
            try:
                util.unlink(repo.wjoin(f))
            except OSError, inst:
                if inst.errno != errno.ENOENT:
                    repo.ui.warn(
                        _("update failed to remove %s: %s!\n") %
                        (f, inst.strerror))
            removed += 1
        elif m == "m":  # merge
            f2, fd, flags, move = a[2:]
            r = filemerge.filemerge(repo, f, fd, f2, wctx, mctx)
            if r > 0:
                unresolved += 1
            else:
                if r is None:
                    updated += 1
                else:
                    merged += 1
            util.set_flags(repo.wjoin(fd), 'l' in flags, 'x' in flags)
            if f != fd and move and util.lexists(repo.wjoin(f)):
                repo.ui.debug(_("removing %s\n") % f)
                os.unlink(repo.wjoin(f))
コード例 #8
0
ファイル: merge.py プロジェクト: c0ns0le/cygwin
def applyupdates(repo, action, wctx, mctx):
    "apply the merge action list to the working directory"

    updated, merged, removed, unresolved = 0, 0, 0, 0
    action.sort()
    # prescan for copy/renames
    for a in action:
        f, m = a[:2]
        if m == 'm': # merge
            f2, fd, flags, move = a[2:]
            if f != fd:
                repo.ui.debug(_("copying %s to %s\n") % (f, fd))
                repo.wwrite(fd, repo.wread(f), flags)

    audit_path = util.path_auditor(repo.root)

    for a in action:
        f, m = a[:2]
        if f and f[0] == "/":
            continue
        if m == "r": # remove
            repo.ui.note(_("removing %s\n") % f)
            audit_path(f)
            try:
                util.unlink(repo.wjoin(f))
            except OSError, inst:
                if inst.errno != errno.ENOENT:
                    repo.ui.warn(_("update failed to remove %s: %s!\n") %
                                 (f, inst.strerror))
            removed += 1
        elif m == "m": # merge
            f2, fd, flags, move = a[2:]
            r = filemerge.filemerge(repo, f, fd, f2, wctx, mctx)
            if r > 0:
                unresolved += 1
            else:
                if r is None:
                    updated += 1
                else:
                    merged += 1
            util.set_flags(repo.wjoin(fd), 'l' in flags, 'x' in flags)
            if f != fd and move and util.lexists(repo.wjoin(f)):
                repo.ui.debug(_("removing %s\n") % f)
                os.unlink(repo.wjoin(f))
コード例 #9
0
ファイル: merge.py プロジェクト: ZanderZhang/Andriod-Learning
 def resolve(self, dfile, wctx, labels=None):
     """rerun merge process for file path `dfile`"""
     if self[dfile] == 'r':
         return 0
     stateentry = self._state[dfile]
     state, hash, lfile, afile, anode, ofile, onode, flags = stateentry
     octx = self._repo[self._other]
     fcd = wctx[dfile]
     fco = octx[ofile]
     fca = self._repo.filectx(afile, fileid=anode)
     # "premerge" x flags
     flo = fco.flags()
     fla = fca.flags()
     if 'x' in flags + flo + fla and 'l' not in flags + flo + fla:
         if fca.node() == nullid:
             self._repo.ui.warn(
                 _('warning: cannot merge flags for %s\n') % afile)
         elif flags == fla:
             flags = flo
     # restore local
     f = self._repo.opener("merge/" + hash)
     self._repo.wwrite(dfile, f.read(), flags)
     f.close()
     r = filemerge.filemerge(self._repo,
                             self._local,
                             lfile,
                             fcd,
                             fco,
                             fca,
                             labels=labels)
     if r is None:
         # no real conflict
         del self._state[dfile]
         self._dirty = True
     elif not r:
         self.mark(dfile, 'r')
     return r