Parcourir la source

Merge branch 'develop'

tags/v0.3
Ben Kurtovic il y a 10 ans
Parent
révision
2806155a9d
2 fichiers modifiés avec 10 ajouts et 5 suppressions
  1. +1
    -1
      gitup/__init__.py
  2. +9
    -4
      gitup/update.py

+ 1
- 1
gitup/__init__.py Voir le fichier

@@ -10,5 +10,5 @@ gitup: the git repository updater
__author__ = "Ben Kurtovic" __author__ = "Ben Kurtovic"
__copyright__ = "Copyright (C) 2011-2014 Ben Kurtovic" __copyright__ = "Copyright (C) 2011-2014 Ben Kurtovic"
__license__ = "MIT License" __license__ = "MIT License"
__version__ = "0.2.1"
__version__ = "0.2.2"
__email__ = "ben.kurtovic@gmail.com" __email__ = "ben.kurtovic@gmail.com"

+ 9
- 4
gitup/update.py Voir le fichier

@@ -186,7 +186,8 @@ def _update_branch(repo, branch, merge, rebase, stasher=None):


def _update_branches(repo, active, merge, rebase): def _update_branches(repo, active, merge, rebase):
"""Update a list of branches.""" """Update a list of branches."""
_update_branch(repo, active, merge, rebase)
if active:
_update_branch(repo, active, merge, rebase)
branches = set(repo.heads) - {active} branches = set(repo.heads) - {active}
if branches: if branches:
stasher = _Stasher(repo) stasher = _Stasher(repo)
@@ -194,7 +195,8 @@ def _update_branches(repo, active, merge, rebase):
for branch in sorted(branches, key=lambda b: b.name): for branch in sorted(branches, key=lambda b: b.name):
_update_branch(repo, branch, merge, rebase, stasher) _update_branch(repo, branch, merge, rebase, stasher)
finally: finally:
active.checkout()
if active:
active.checkout()
stasher.restore() stasher.restore()


def _update_repository(repo, current_only=False, rebase=False, merge=False): def _update_repository(repo, current_only=False, rebase=False, merge=False):
@@ -209,9 +211,12 @@ def _update_repository(repo, current_only=False, rebase=False, merge=False):
""" """
print(INDENT1, BOLD + os.path.split(repo.working_dir)[1] + ":") print(INDENT1, BOLD + os.path.split(repo.working_dir)[1] + ":")


active = repo.active_branch
try:
active = repo.active_branch
except TypeError: # Happens when HEAD is detached
active = None
if current_only: if current_only:
ref = active.tracking_branch()
ref = active.tracking_branch() if active else None
if not ref: if not ref:
print(INDENT2, ERROR, "no remote tracked by current branch.") print(INDENT2, ERROR, "no remote tracked by current branch.")
return return


Chargement…
Annuler
Enregistrer