Skip to content

Commit

Permalink
Removed unused code (#148)
Browse files Browse the repository at this point in the history
* Removed unused code

* Update makemigrations.py
  • Loading branch information
jackton1 committed Sep 4, 2021
1 parent 1a1a9e3 commit 9061450
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions migration_fixer/management/commands/makemigrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,37 +112,36 @@ def handle(self, *app_labels, **options):
)
)

default_branch_commit = self.repo.commit(self.default_branch)

current_commit = self.repo.head.commit

if not self.skip_default_branch_update:
if self.verbosity >= 2:
self.stdout.write(
f"Fetching git remote {self.remote} changes on: {self.default_branch}"
)

if current_commit == default_branch_commit: # pragma: no cover
try:
remote = self.repo.remotes[self.remote]
remote.pull(
self.default_branch,
remote.fetch(
f"{self.default_branch}:{self.default_branch}",
force=self.force_update,
)
else:
except GitCommandError: # pragma: no cover
try:
remote = self.repo.remotes[self.remote]
remote.fetch(
f"{self.default_branch}:{self.default_branch}",
remote.pull(
self.default_branch,
force=self.force_update,
)
except GitCommandError as e: # pragma: no cover
except GitCommandError as e:
raise CommandError(
self.style.ERROR(
f"Unable to fetch {self.remote} branch "
f"Unable to retrieve changes from {self.remote} branch "
f"'{self.default_branch}': {e.stderr}",
),
)

default_branch_commit = self.repo.commit(self.default_branch)
current_commit = self.repo.head.commit

if self.verbosity >= 2:
self.stdout.write(
f"Retrieving the last commit sha on: {self.default_branch}"
Expand Down

0 comments on commit 9061450

Please sign in to comment.