repo sync fatal: 出错的补丁
repo sync下载代码时经常 fatal: read error: Connection reset by peer
可能是向同一个repo url连接数过多引起的吧
此补丁增加了 repo sync --ignore-list选项, 配合repo sync -j1 使用,可以在失败后不再重新同步已经同步过的工程,能缓解出错的情况
diff --git a/project.py b/project.py
index 22e4a5d..f2e7ccc 100644
--- a/project.py
+++ b/project.py
@@ -490,7 +490,8 @@ class Project(object):sync_s = False,upstream = None,parent = None,
- is_derived = False):
+ is_derived = False,
+ is_ignored = False):"""Init a Project object.Args:
@@ -536,6 +537,7 @@ class Project(object):self.upstream = upstreamself.parent = parentself.is_derived = is_derived
+ self.is_ignored = is_ignoredself.subprojects = []self.snapshots = {}
diff --git a/subcmds/sync.py b/subcmds/sync.py
index 9ed84b9..d3639b1 100644
--- a/subcmds/sync.py
+++ b/subcmds/sync.py
@@ -192,6 +192,10 @@ later is required to fix a server side protocol bug.p.add_option('--no-tags',dest='no_tags', action='store_true',help="don't fetch tags")
+ p.add_option('--ignore-list',
+ dest='ignore_list', action='store_true',
+ help="don't fetch projects in ignore-list")
+if show_smart:p.add_option('-s', '--smart-sync',dest='smart_sync', action='store_true',
@@ -267,12 +271,30 @@ later is required to fix a server side protocol bug.lock.release()sem.release()+ def Append_ignore_projects(self,name):
+ file_name = 'project.ignore'
+ file_path = os.path.join(self.manifest.repodir, file_name)
+
+ #if os.path.exists(file_path):
+ fd = open(file_path, 'a')
+ try:
+ print(name, file=fd)
+ finally:
+ fd.close()
+def _Fetch(self, projects, opt):fetched = set()pm = Progress('Fetching projects', len(projects))if self.jobs == 1:for project in projects:
+ if project.is_ignored:
+ print("Ignore project={0}".format(project.name))
+ pm.update()
+ fetched.add(project.gitdir)
+ continue
+
+ print("Fetching project={0}".format(project.name))pm.update()if project.Sync_NetworkHalf(quiet=opt.quiet,
@@ -280,6 +302,9 @@ later is required to fix a server side protocol bug.clone_bundle=not opt.no_clone_bundle,no_tags=opt.no_tags):fetched.add(project.gitdir)
+ print("\nFetchDone: {0}".format(project.name))
+ if opt.ignore_list:
+ self.Append_ignore_projects(project.relpath)else:print('error: Cannot fetch %s' % project.name, file=sys.stderr)if opt.force_broken:
@@ -379,6 +404,18 @@ later is required to fix a server side protocol bug.else:self.manifest._Unload()+ def GetIgnoreProjectsName(self):
+ file_name = 'project.ignore'
+ file_path = os.path.join(self.manifest.repodir, file_name)
+ project_names = 0
+ if os.path.exists(file_path):
+ fd = open(file_path, 'r')
+ try:
+ project_names = fd.read().split('\n')
+ finally:
+ fd.close()
+ return project_names
+def UpdateProjectList(self):new_project_paths = []for project in self.GetProjects(None, missing_ok=True):
@@ -585,6 +622,20 @@ later is required to fix a server side protocol bug.missing_ok=True,submodules_ok=opt.fetch_submodules)+ if opt.ignore_list:
+ ignore_projects_name = self.GetIgnoreProjectsName()
+ #print(ignore_projects_name)
+ #for i in all_projects:
+ # print(i.name)
+ #sys.exit(1)
+ if ignore_projects_name:
+ temp_projects = []
+ for i in all_projects:
+ if i.relpath in ignore_projects_name:
+ i.is_ignored = True
+ temp_projects.append(i)
+ all_projects = temp_projects
+self._fetch_times = _FetchTimes(self.manifest)if not opt.local_only:to_fetch = []
repo sync fatal: 出错的补丁相关推荐
- repo sync error.GitError: manifests rev-list : fatal: revision walk setup failed
更新代码是repo sync 出错:error.GitError: manifests rev-list ('^HEAD', u'a78728c68089372c3ce03a76f10143d7a5d ...
- repo sync 更新源码 android-12.0.0_r34, fatal: 不能重置索引文件至版本 ‘v2.27^0‘。
文章目录 1. 问题描述 2. 错误日志 2.1 操作过程 2.2 错误分析 3.解决办法 4. 最后 1. 问题描述 AOSP 12的源码两月没有更新了,今日对其做repo sync动作,并切换到新 ...
- 加速repo sync的技巧
.repo/manifests/中新建一个test.xml 里面写入 <?xml version="1.0" encoding="utf-8"?> ...
- 如何使用repo sync
我們知道 repo 是 Google 為 Android source tree 的管理而寫的一個 script,以方便處理 Android 源碼包含的上百個 git repositories.要取得 ...
- git.exe init#timeout = 10错误:克隆远程repo'origin'时出错hudson.plugins.git
用Jenkins自动化搭建测试环境,Jenkins构建任务 关键异常抓取 git.exe init#timeout = 10错误:克隆远程repo'origin'时出错hudson.plugins.g ...
- repo sync代码断点续传
# emacs auto_download.sh #!/bin/bash repo sync -j4 while [ $? -ne 0 ] dorepo sync -j4 done注意:其中" ...
- git 使用总结(三)repo sync -m
有没有遇到一种困扰,根据repo_manifest.xml新抓到的code ,发现有各种问题,因此想退回到某一版code? 抑或是新的code 与当前的image 有版本兼容的问题,kernel he ...
- repo sync 报错error: apps/xx/: branch master is published (but not merged) and is now N commits behind
在使用repo sync 的时候, 以时候会出现以上错误的时候, 使用: git branch -r 获得upstream的分支信息: m/gingerbread -> umg/kernel/ ...
- repo init 与 repo sync 区别
repo init:更新本地的repo repo sync: 下载代码到本地. repo init to bring down the latest version of Repo with all ...
最新文章
- Swift - static和class的使用
- Angular Component input字段传递值的几种变式 variant
- Android之解决打补丁包后移动端为什么不升级,升级之后出现“应用未安装“,以及更新成功之后反复更新问题
- C#创建用户控件 - IPv4地址输入框
- 在Linux-0.11中实现基于内核栈切换的进程切换
- 用SMO算法实现了SVM的感悟
- es6 字符串 对象 拓展 及 less 的语法
- 求一个序列中,第k个数
- linux shell经典脚本,10个经典Linux Shell脚本
- 单片机C51之1:流水灯
- 在excel中如何筛选重复数据_Excel中12招筛选使用大全,小白也能秒变高手
- 被繁杂的数据搞到头大?让 Google Cloud 大数据平台帮你实现快准狠!
- vue中使用keep-alive无效以及include 和 exclude用法
- 《OD学Oozie》20160807Oozie
- wav转mp3怎么转?几种值得学习的转换方法,打开看看!
- 计算机培训报名表 自我介绍,单招报名表自我介绍
- 20181108_Makefile知识点
- PDF迅捷转换器html网址,如何把PDF转换成HTML?迅捷PDF转换器
- 3D屏保程序:汉诺塔
- mysql You can turn off this feature to get a quicker startup with –A