diff options
| author | Anthony Newnam <anthony.newnam@garmin.com> | 2010-04-08 10:28:59 -0500 |
|---|---|---|
| committer | Shawn O. Pearce <sop@google.com> | 2010-07-15 16:43:58 -0700 |
| commit | cc50bac8c7706082596d70756249d4964a67f281 (patch) | |
| tree | bb87e8d8c128737710db6f00b35327ef28750c5b /project.py | |
| parent | 0cb1b3f687da4634e431953ef84fee59dd3f5d59 (diff) | |
| download | git-repo-cc50bac8c7706082596d70756249d4964a67f281.tar.gz | |
Warn users before uploading if there are local changes
Change-Id: I231d7b6a3211e9f5ec71a542a0109b0c195d5e40
Signed-off-by: Shawn O. Pearce <sop@google.com>
Diffstat (limited to 'project.py')
| -rw-r--r-- | project.py | 21 |
1 files changed, 21 insertions, 0 deletions
| @@ -368,6 +368,27 @@ class Project(object): | |||
| 368 | 368 | ||
| 369 | ## Status Display ## | 369 | ## Status Display ## |
| 370 | 370 | ||
| 371 | def HasChanges(self): | ||
| 372 | """Returns true if there are uncommitted changes. | ||
| 373 | """ | ||
| 374 | self.work_git.update_index('-q', | ||
| 375 | '--unmerged', | ||
| 376 | '--ignore-missing', | ||
| 377 | '--refresh') | ||
| 378 | if self.IsRebaseInProgress(): | ||
| 379 | return True | ||
| 380 | |||
| 381 | if self.work_git.DiffZ('diff-index', '--cached', HEAD): | ||
| 382 | return True | ||
| 383 | |||
| 384 | if self.work_git.DiffZ('diff-files'): | ||
| 385 | return True | ||
| 386 | |||
| 387 | if self.work_git.LsOthers(): | ||
| 388 | return True | ||
| 389 | |||
| 390 | return False | ||
| 391 | |||
| 371 | def PrintWorkTreeStatus(self): | 392 | def PrintWorkTreeStatus(self): |
| 372 | """Prints the status of the repository to stdout. | 393 | """Prints the status of the repository to stdout. |
| 373 | """ | 394 | """ |
