diff options
| author | David Pursehouse <dpursehouse@collab.net> | 2020-02-13 12:41:15 +0900 |
|---|---|---|
| committer | David Pursehouse <dpursehouse@collab.net> | 2020-02-13 04:12:38 +0000 |
| commit | e8ace261177d96a3f138e6ce329af1a89073f3cf (patch) | |
| tree | e41aebaa815039862dc1d6cc7aecadf62b103eff /project.py | |
| parent | daa2cecdc5b8dad4361f9dd0c9acf4dd7a508729 (diff) | |
| download | git-repo-e8ace261177d96a3f138e6ce329af1a89073f3cf.tar.gz | |
project: Don't emit locally modified hook warning in quiet mode
Change-Id: I0f6db037b85f2a015fc7b7fd37472df848a58266
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/254698
Reviewed-by: Mike Frysinger <vapier@google.com>
Tested-by: David Pursehouse <dpursehouse@collab.net>
Diffstat (limited to 'project.py')
| -rw-r--r-- | project.py | 22 |
1 files changed, 12 insertions, 10 deletions
| @@ -1470,9 +1470,9 @@ class Project(object): | |||
| 1470 | if is_new is None: | 1470 | if is_new is None: |
| 1471 | is_new = not self.Exists | 1471 | is_new = not self.Exists |
| 1472 | if is_new: | 1472 | if is_new: |
| 1473 | self._InitGitDir(force_sync=force_sync) | 1473 | self._InitGitDir(force_sync=force_sync, quiet=quiet) |
| 1474 | else: | 1474 | else: |
| 1475 | self._UpdateHooks() | 1475 | self._UpdateHooks(quiet=quiet) |
| 1476 | self._InitRemote() | 1476 | self._InitRemote() |
| 1477 | 1477 | ||
| 1478 | if is_new: | 1478 | if is_new: |
| @@ -2590,7 +2590,7 @@ class Project(object): | |||
| 2590 | if GitCommand(self, cmd).Wait() != 0: | 2590 | if GitCommand(self, cmd).Wait() != 0: |
| 2591 | raise GitError('%s merge %s ' % (self.name, head)) | 2591 | raise GitError('%s merge %s ' % (self.name, head)) |
| 2592 | 2592 | ||
| 2593 | def _InitGitDir(self, mirror_git=None, force_sync=False): | 2593 | def _InitGitDir(self, mirror_git=None, force_sync=False, quiet=False): |
| 2594 | init_git_dir = not os.path.exists(self.gitdir) | 2594 | init_git_dir = not os.path.exists(self.gitdir) |
| 2595 | init_obj_dir = not os.path.exists(self.objdir) | 2595 | init_obj_dir = not os.path.exists(self.objdir) |
| 2596 | try: | 2596 | try: |
| @@ -2618,7 +2618,8 @@ class Project(object): | |||
| 2618 | if self.worktree and os.path.exists(platform_utils.realpath | 2618 | if self.worktree and os.path.exists(platform_utils.realpath |
| 2619 | (self.worktree)): | 2619 | (self.worktree)): |
| 2620 | platform_utils.rmtree(platform_utils.realpath(self.worktree)) | 2620 | platform_utils.rmtree(platform_utils.realpath(self.worktree)) |
| 2621 | return self._InitGitDir(mirror_git=mirror_git, force_sync=False) | 2621 | return self._InitGitDir(mirror_git=mirror_git, force_sync=False, |
| 2622 | quiet=quiet) | ||
| 2622 | except Exception: | 2623 | except Exception: |
| 2623 | raise e | 2624 | raise e |
| 2624 | raise e | 2625 | raise e |
| @@ -2650,7 +2651,7 @@ class Project(object): | |||
| 2650 | _lwrite(os.path.join(self.gitdir, 'objects/info/alternates'), | 2651 | _lwrite(os.path.join(self.gitdir, 'objects/info/alternates'), |
| 2651 | os.path.join(ref_dir, 'objects') + '\n') | 2652 | os.path.join(ref_dir, 'objects') + '\n') |
| 2652 | 2653 | ||
| 2653 | self._UpdateHooks() | 2654 | self._UpdateHooks(quiet=quiet) |
| 2654 | 2655 | ||
| 2655 | m = self.manifest.manifestProject.config | 2656 | m = self.manifest.manifestProject.config |
| 2656 | for key in ['user.name', 'user.email']: | 2657 | for key in ['user.name', 'user.email']: |
| @@ -2669,11 +2670,11 @@ class Project(object): | |||
| 2669 | platform_utils.rmtree(self.gitdir) | 2670 | platform_utils.rmtree(self.gitdir) |
| 2670 | raise | 2671 | raise |
| 2671 | 2672 | ||
| 2672 | def _UpdateHooks(self): | 2673 | def _UpdateHooks(self, quiet=False): |
| 2673 | if os.path.exists(self.gitdir): | 2674 | if os.path.exists(self.gitdir): |
| 2674 | self._InitHooks() | 2675 | self._InitHooks(quiet=quiet) |
| 2675 | 2676 | ||
| 2676 | def _InitHooks(self): | 2677 | def _InitHooks(self, quiet=False): |
| 2677 | hooks = platform_utils.realpath(self._gitdir_path('hooks')) | 2678 | hooks = platform_utils.realpath(self._gitdir_path('hooks')) |
| 2678 | if not os.path.exists(hooks): | 2679 | if not os.path.exists(hooks): |
| 2679 | os.makedirs(hooks) | 2680 | os.makedirs(hooks) |
| @@ -2696,8 +2697,9 @@ class Project(object): | |||
| 2696 | if filecmp.cmp(stock_hook, dst, shallow=False): | 2697 | if filecmp.cmp(stock_hook, dst, shallow=False): |
| 2697 | platform_utils.remove(dst) | 2698 | platform_utils.remove(dst) |
| 2698 | else: | 2699 | else: |
| 2699 | _warn("%s: Not replacing locally modified %s hook", | 2700 | if not quiet: |
| 2700 | self.relpath, name) | 2701 | _warn("%s: Not replacing locally modified %s hook", |
| 2702 | self.relpath, name) | ||
| 2701 | continue | 2703 | continue |
| 2702 | try: | 2704 | try: |
| 2703 | platform_utils.symlink( | 2705 | platform_utils.symlink( |
