repo sync 时自动切换当前分支的remote track分支的问题

使用repo sync时,如果当前仓库有检出本地分支,假设为dev, 对应的远程track分支为origin/dev。 而manifest.xml中指定的track分支为origin/master,那么在repo sync时会自动将当前的dev分支的远程track分支修改为origin/master, 不仅如此,同时还会将origin/master上的修改rebase到本地的这个dev分支上。


projectA/: manifest switched refs/heads/dev...master
project projectA/
First, rewinding head to replay your work on top of it...
Applying: y

虽然repo会给出上面的提示信息"  manifest switched",但经常会被接下来的输出淹没掉,而且很多时候这样的行为都不是我们想要的,要想终止这个行为,可以这样修改

diff --git a/project.py b/project.py
index 22e4a5d..3ce6500 100644
--- a/project.py
+++ b/project.py
@@ -1169,6 +1169,8 @@ class Project(object):
         syncbuf.info(self,
                      'manifest no longer tracks %s',
                      branch.merge)
+      syncbuf.fail(self, "branch is not consistent:%s, %s" %(branch.merge, self.revisionExpr))  
+      return
 
     if cnt_mine < len(local_changes):
       # Upstream rebased.  Not everything in HEAD


that's all

猜你喜欢

转载自blog.csdn.net/crylearner/article/details/38072373
今日推荐