summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Ruggier <Simon80@gmail.com>2015-07-31 17:18:34 -0400
committerSimon Ruggier <Simon80@gmail.com>2015-08-04 18:41:20 -0400
commitf9b7683a3bf979d6cef50d691165280d64566ee4 (patch)
treeb9d86c89ebf62c6a81898223f0f702f6c4c5eac6
parent7e59de2bcc8513ba28701062be2637d90cb6eeff (diff)
downloadgit-repo-f9b7683a3bf979d6cef50d691165280d64566ee4.tar.gz
Include project path in --force-sync error message
For projects that have been cloned outside of the repo command (or cloned a long time ago), commit abaa7f312f1b6c8d11d7c757fe909900ce5788b5 introduced an error message to invite the user to use --force-sync. However, due to the risk of data loss, it's useful to know which project's git directory is being replaced before deciding whether or not to provide --force-sync. This change updates the exception's associated value to include the project's relative path and explain to the user how they can resolve the issue. A previous version of this commit used the project name. However, for projects that have multiple work trees, the name can be ambiguous, while the path clearly identifies which git directory will be replaced. Change-Id: If717e66fda4d19accc0a8e889a91f4cd4ff14dff
-rw-r--r--project.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/project.py b/project.py
index 9cb7542e..fb9df2aa 100644
--- a/project.py
+++ b/project.py
@@ -2323,7 +2323,10 @@ class Project(object):
2323 # Fail if the links are pointing to the wrong place 2323 # Fail if the links are pointing to the wrong place
2324 if src != dst: 2324 if src != dst:
2325 raise GitError('--force-sync not enabled; cannot overwrite a local ' 2325 raise GitError('--force-sync not enabled; cannot overwrite a local '
2326 'work tree') 2326 'work tree. If you\'re comfortable with the '
2327 'possibility of losing the work tree\'s git metadata,'
2328 ' use `repo sync --force-sync {0}` to '
2329 'proceed.'.format(self.relpath))
2327 2330
2328 def _ReferenceGitDir(self, gitdir, dotgit, share_refs, copy_all): 2331 def _ReferenceGitDir(self, gitdir, dotgit, share_refs, copy_all):
2329 """Update |dotgit| to reference |gitdir|, using symlinks where possible. 2332 """Update |dotgit| to reference |gitdir|, using symlinks where possible.