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 ...
最新文章
- 【OpenCV】将图像数据由YUV格式转换成JPG格式直接使用,而不保存成文件
- liunx php redis扩展,CentOS 7下安装php-redis扩展及简单使用
- python使用tomorrow实现多线程
- Filter在Vue,JS,JQ中的使用
- 数据库-事务并发操作问题及并发的控制
- CodeForces - 1332B Composite Coloring(数论+构造)
- Visual studio 打包
- 写lua时需要注意的地方
- c+gui语言可视化编程
- Lumia 800 7.10.8783.12
- origin9语言设置中文_《英雄联盟手游》界面翻译图 LOL手游界面设置全翻译图一览...
- 转:性能测试常见术语
- 在 Google 工作是什么体验?
- python模块之scipy的层次聚类简单测试与使用
- java sequence 生成器_分布式高效唯一ID生成器(sequence)
- 盘点常见元器件级性识别方法
- 【大数据】大数据技术框架,有这一篇文章就够了
- 三态门有一个信号控制端en_什么是三态门? 三态逻辑与非门电路以及三态门电路...
- 那个丧心病狂的红蓝眼睛逻辑问题推理:第N天有N个红眼睛自杀,还是什么都不会发生?
- PX4 Position_Control RC_Remoter引入