Exemplo n.º 1
0
    def _update_tree_state_cache(self, path, tree_state):
        """ Update the state of the file(s) at tree_state['path'] """
        while 1:
            try:
                # Update the index before getting status, otherwise we could
                # be reading stale status information
                _vc.popen(["git", "update-index", "--refresh"],
                          cwd=self.location)

                # Get the status of files that are different in the "index" vs
                # the HEAD of the git repository
                proc = _vc.popen([self.CMD, "diff-index", "--name-status", \
                    "--cached", "HEAD", path], cwd=self.location)
                entries = proc.read().split("\n")[:-1]

                # Get the status of files that are different in the "index" vs
                # the files on disk
                proc = _vc.popen([self.CMD, "diff-files", "--name-status", \
                    "-0", path], cwd=self.location)
                entries += (proc.read().split("\n")[:-1])

                proc = _vc.popen([self.CMD, "ls-files", "--others", \
                    "--ignored", "--exclude-standard", path], cwd=self.location)
                entries += ("I\t%s" % f for f in proc.read().split("\n")[:-1])

                # An unmerged file or a file that has been modified, added to
                # git's index, then modified again would result in the file
                # showing up in both the output of "diff-files" and
                # "diff-index".  The following command removes duplicate
                # file entries.
                entries = list(set(entries))
                break
            except OSError, e:
                if e.errno != errno.EAGAIN:
                    raise
Exemplo n.º 2
0
 def _lookup_tree_cache(self, rootdir):
     branch_root = _vc.popen([self.CMD, "root", rootdir]).read().rstrip('\n')
     while 1:
         try:
             proc = _vc.popen([self.CMD, "status", branch_root])
             entries = proc.read().split("\n")[:-1]
             break
         except OSError, e:
             if e.errno != errno.EAGAIN:
                 raise
Exemplo n.º 3
0
    def _get_dirsandfiles(self, directory, dirs, files):

        while 1:
            try:
                entries = _vc.popen([self.CMD, "status", "-A", "."], cwd=directory).read().split("\n")[:-1]
                break
            except OSError, e:
                if e.errno != errno.EAGAIN:
                    raise
Exemplo n.º 4
0
 def _lookup_tree_cache(self, rootdir):
     while 1:
         try:
             entries = _vc.popen([self.CMD, "automate", "inventory"],
                                 cwd=self.root).read().split("\n")[:-1]
             break
         except OSError, e:
             if e.errno != errno.EAGAIN:
                 raise
Exemplo n.º 5
0
 def _lookup_tree_cache(self, rootdir):
     while 1:
         try:
             entries = _vc.popen([self.CMD, "ls", "-l"],
                                 cwd=self.root).read().split("\n")[:-1]
             break
         except OSError, e:
             if e.errno != errno.EAGAIN:
                 raise
Exemplo n.º 6
0
    def _get_dirsandfiles(self, directory, dirs, files):

        while 1:
            try:
                entries = _vc.popen([self.CMD, "status", "-A", "."], cwd=directory).read().split("\n")[:-1]
                break
            except OSError, e:
                if e.errno != errno.EAGAIN:
                    raise
Exemplo n.º 7
0
 def _lookup_tree_cache(self, rootdir):
     while 1:
         try:
             proc = _vc.popen([self.CMD, "status", "--untracked-files"], cwd=self.root)
             entries = proc.read().split("\n")[:-1]
             break
         except OSError, e:
             if e.errno != errno.EAGAIN:
                 raise
Exemplo n.º 8
0
Arquivo: svn.py Projeto: lemonov/meld
 def _update_tree_state_cache(self, path, tree_state):
     while 1:
         try:
             status_cmd = [self.CMD, "status", "-v", "--xml", path]
             tree = ElementTree.parse(_vc.popen(status_cmd))
             break
         except OSError, e:
             if e.errno != errno.EAGAIN:
                 raise
Exemplo n.º 9
0
 def _update_tree_state_cache(self, path, tree_state):
     while 1:
         try:
             status_cmd = [self.CMD, "status", "-v", "--xml", path]
             tree = ElementTree.parse(_vc.popen(status_cmd))
             break
         except OSError, e:
             if e.errno != errno.EAGAIN:
                 raise
Exemplo n.º 10
0
Arquivo: git.py Projeto: mpjmuniz/meld
 def _lookup_tree_cache(self, rootdir):
     while 1:
         try:
             proc = _vc.popen([self.CMD, "status", "--untracked-files"],
                              cwd=self.root)
             entries = proc.read().split("\n")[:-1]
             break
         except OSError, e:
             if e.errno != errno.EAGAIN:
                 raise
Exemplo n.º 11
0
Arquivo: tla.py Projeto: mpjmuniz/meld
 def _lookup_tree_cache(self, rootdir):
     whatsnew = {}
     commandline = [self.CMD, "changes", "-d", self.root]
     while 1:
         try:
             p = _vc.popen(commandline)
             break
         except OSError, e:
             if e.errno != errno.EAGAIN:
                 raise
Exemplo n.º 12
0
Arquivo: svn.py Projeto: mpjmuniz/meld
    def _get_matches(self, directory):
        """return a list of tuples (file_path, status_code, revision)"""

        while 1:
            try:
                entries = _vc.popen([self.CMD, "status", "-Nv", directory])
                break
            except OSError, e:
                if e.errno != errno.EAGAIN:
                    raise
Exemplo n.º 13
0
    def _get_matches(self, directory):
        """return a list of tuples (file_path, status_code, revision)"""

        while 1:
            try:
                entries = _vc.popen([self.CMD, "status", "-Nv", directory])
                break
            except OSError, e:
                if e.errno != errno.EAGAIN:
                    raise
Exemplo n.º 14
0
 def _lookup_tree_cache(self, rootdir):
     whatsnew = {}
     commandline = [self.CMD, "changes", "-d", self.root]
     while 1:
         try:
             p = _vc.popen(commandline)
             break
         except OSError, e:
             if e.errno != errno.EAGAIN:
                 raise
Exemplo n.º 15
0
 def _get_whatsnew(self, boring=False):
     whatsnew = {}
     commandline = [self.CMD, "whatsnew", "--summary", "-l", "--repodir=" + self.root]
     if boring:
         commandline.append("--boring")
     while 1:
         try:
             p = _vc.popen(commandline)
             break
         except OSError, e:
             if e.errno != errno.EAGAIN:
                 raise
Exemplo n.º 16
0
 def _get_whatsnew(self, boring=False):
     whatsnew = {}
     commandline = [self.CMD, "whatsnew", "--summary", "-l" "--repodir="+self.root]
     if boring:
         commandline.append("--boring")
     while 1:
         try:
             p = _vc.popen(commandline)
             break
         except OSError, e:
             if e.errno != errno.EAGAIN:
                 raise
Exemplo n.º 17
0
 def choose_monotone_version(self):
     try:
         # for monotone >= 0.26
         self.VC_DIR = "_MTN"
         self.CMD = "mtn"
         self.interface_version = float(_vc.popen([self.CMD, "automate", "interface_version"]).read())
         if self.interface_version > 9.0:
             print "WARNING: Unsupported interface version (please report any problems to the meld mailing list)"
     except (ValueError, OSError):
         # for monotone <= 0.25
         self.VC_DIR = "MT"
         self.CMD = "monotone"
Exemplo n.º 18
0
 def choose_monotone_version(self):
     try:
         # for monotone >= 0.26
         self.VC_DIR = "_MTN"
         self.CMD = "mtn"
         self.interface_version = float(
             _vc.popen([self.CMD, "automate", "interface_version"]).read())
         if self.interface_version > 9.0:
             print "WARNING: Unsupported interface version (please report any problems to the meld mailing list)"
     except (ValueError, OSError):
         # for monotone <= 0.25
         self.VC_DIR = "MT"
         self.CMD = "monotone"
Exemplo n.º 19
0
    def _get_dirsandfiles(self, directory, dirs, files):

        tree = self._get_tree_cache(directory)

        retfiles = []
        retdirs = []
        vcfiles = {}

        for path, state in tree.iteritems():
            mydir, name = os.path.split(path)
            if path.endswith('/'):
                mydir, name = os.path.split(mydir)
            if mydir != directory:
                continue

            rev = ""
            while True:
                try:
                    entries = _vc.popen([self.CMD, "finfo", "-s", path],
                                        cwd=self.root).read().split(" ", 1)
                    # Process entries which have revision numbers.
                    if entries[0] in ['renamed', 'edited', 'deleted',
                                      'unchanged']:
                        rev = entries[1].strip()
                    break
                except OSError, e:
                    if e.errno != errno.EAGAIN:
                        raise

            options, tag = "", ""
            if path.endswith('/'):
                retdirs.append(_vc.Dir(path[:-1], name, state))
            else:
                retfiles.append(_vc.File(path, name, state, rev, tag,
                        options))
            vcfiles[name] = 1
Exemplo n.º 20
0
    def _get_dirsandfiles(self, directory, dirs, files):

        tree = self._get_tree_cache(directory)

        retfiles = []
        retdirs = []
        vcfiles = {}

        for path, state in tree.iteritems():
            mydir, name = os.path.split(path)
            if path.endswith('/'):
                mydir, name = os.path.split(mydir)
            if mydir != directory:
                continue

            rev = ""
            while True:
                try:
                    entries = _vc.popen([self.CMD, "finfo", "-s", path],
                                        cwd=self.root).read().split(" ", 1)
                    # Process entries which have revision numbers.
                    if entries[0] in [
                            'renamed', 'edited', 'deleted', 'unchanged'
                    ]:
                        rev = entries[1].strip()
                    break
                except OSError, e:
                    if e.errno != errno.EAGAIN:
                        raise

            options, tag = "", ""
            if path.endswith('/'):
                retdirs.append(_vc.Dir(path[:-1], name, state))
            else:
                retfiles.append(_vc.File(path, name, state, rev, tag, options))
            vcfiles[name] = 1
Exemplo n.º 21
0
    def _update_tree_state_cache(self, path, tree_state):
        """ Update the state of the file(s) at tree_state['path'] """
        while 1:
            try:
                # Update the index before getting status, otherwise we could
                # be reading stale status information
                _vc.popen(["git", "update-index", "--refresh"],
                          cwd=self.location)

                # Get the status of files that are different in the "index" vs
                # the HEAD of the git repository
                proc = _vc.popen([self.CMD, "diff-index", "--name-status", \
                    "--cached", "HEAD", path], cwd=self.location)
                entries = proc.read().split("\n")[:-1]

                # Get the status of files that are different in the "index" vs
                # the files on disk
                proc = _vc.popen([self.CMD, "diff-files", "--name-status", \
                    "-0", path], cwd=self.location)
                entries += (proc.read().split("\n")[:-1])

                # Identify ignored files
                proc = _vc.popen([self.CMD, "ls-files", "--others", \
                    "--ignored", "--exclude-standard", path], cwd=self.location)
                entries += ("I\t%s" % f for f in proc.read().split("\n")[:-1])

                # Identify unversioned files
                proc = _vc.popen([self.CMD, "ls-files", "--others", \
                    "--exclude-standard", path], cwd=self.location)
                entries += ("?\t%s" % f for f in proc.read().split("\n")[:-1])

                # An unmerged file or a file that has been modified, added to
                # git's index, then modified again would result in the file
                # showing up in both the output of "diff-files" and
                # "diff-index".  The following command removes duplicate
                # file entries.
                entries = list(set(entries))
                break
            except OSError, e:
                if e.errno != errno.EAGAIN:
                    raise
Exemplo n.º 22
0
 def _get_matches(self, directory):
     entries = _vc.popen([self.CMD, "status"], cwd=directory).read()
     for line in entries.split("\n")[1:-1]:
         yield line[3:], line[0], ""
Exemplo n.º 23
0
 def _get_matches(self, directory):
     entries = _vc.popen([self.CMD, "status"], cwd=directory).read()
     for line in entries.split("\n")[1:-1]:
         yield line[3:], line[0], ""