clearml_agent/helper/repo.py
def patch(self, location, patch_content):
        # type: (PathLike, Text) -> bool
        """
        Apply patch repository at `location`
        """
        self.log.info("applying diff to %s" % location)

        # noinspection PyBroadException
        try:
            for match in filter(
                None, map(self.PATCH_ADDED_FILE_RE.match, patch_content.splitlines())
            ):
                file_path = None
                # noinspection PyBroadException
                try:
                    file_path = normalize_path(location, match.group("path"))
                    create_file_if_not_exists(file_path)
                except Exception:
                    if file_path:
                        self.log.warning("failed creating file for git diff (%s)" % file_path)
        except Exception:
            pass

        return_code, errors = self.call_with_stdin(
            patch_content, *self.patch_base, cwd=location
        )
        if return_code:
            self.log.error("Failed applying diff")
            lines = errors.splitlines()
            if any(l for l in lines if "no such file or directory" in l.lower()):
                self.log.warning(
                    "NOTE: files were not found when applying diff, perhaps you forgot to push your changes?"
                )
            return False
        else:
            self.log.info("successfully applied uncommitted changes")
        return True

        Apply patch repository at `location`
        
Apply patch repository at `location`
Apply patch repository at ` location `
def patch(self, location, patch_content):
        self.log.info("applying diff to %s" % location)
        try:
            for match in filter(
                None, map(self.PATCH_ADDED_FILE_RE.match, patch_content.splitlines())
            ):
                file_path = None
                try:
                    file_path = normalize_path(location, match.group("path"))
                    create_file_if_not_exists(file_path)
                except Exception:
                    if file_path:
                        self.log.warning("failed creating file for git diff (%s)" % file_path)
        except Exception:
            pass
        return_code, errors = self.call_with_stdin(
            patch_content, *self.patch_base, cwd=location
        )
        if return_code:
            self.log.error("Failed applying diff")
            lines = errors.splitlines()
            if any(l for l in lines if "no such file or directory" in l.lower()):
                self.log.warning(
                    "NOTE: files were not found when applying diff, perhaps you forgot to push your changes?"
                )
            return False
        else:
            self.log.info("successfully applied uncommitted changes")
        return True
def patch ( self , location , patch_content ) : self . log . info ( "applying diff to %s" % location ) try : for match in filter ( None , map ( self . PATCH_ADDED_FILE_RE . match , patch_content . splitlines ( ) ) ) : file_path = None try : file_path = normalize_path ( location , match . group ( "path" ) ) create_file_if_not_exists ( file_path ) except Exception : if file_path : self . log . warning ( "failed creating file for git diff (%s)" % file_path ) except Exception : pass return_code , errors = self . call_with_stdin ( patch_content , * self . patch_base , cwd = location ) if return_code : self . log . error ( "Failed applying diff" ) lines = errors . splitlines ( ) if any ( l for l in lines if "no such file or directory" in l . lower ( ) ) : self . log . warning ( "NOTE: files were not found when applying diff, perhaps you forgot to push your changes?" ) return False else : self . log . info ( "successfully applied uncommitted changes" ) return True
Apply patch repository at `location`
Apply patch repository at ` location `
# type: (PathLike, Text) -> bool """
        Apply patch repository at `location`
        """ # noinspection PyBroadException # noinspection PyBroadException
self
location
patch_content