Quellcode durchsuchen

Add a __main__.py; fix GitPython remote fetch error message.

tags/v0.5
Ben Kurtovic vor 6 Jahren
Ursprung
Commit
3eb6e16892
4 geänderte Dateien mit 24 neuen und 3 gelöschten Zeilen
  1. +2
    -0
      CHANGELOG
  2. +9
    -0
      gitup/__main__.py
  3. +3
    -1
      gitup/script.py
  4. +10
    -2
      gitup/update.py

+ 2
- 0
CHANGELOG Datei anzeigen

@@ -8,8 +8,10 @@ v0.5 (unreleased):
old behavior.
- `--depth 3` will look three levels deep. This is the new default.
- `--depth -1` will recurse indefinitely. This is not recommended.
- Allow gitup to be run directly as a Python module (python -m gitup).
- Fixed an error when updating branches if the upstream is completely unrelated
from the local branch (no common ancestor).
- Fixed error message when fetching from a remote fails.

v0.4.1 (released December 13, 2017):



+ 9
- 0
gitup/__main__.py Datei anzeigen

@@ -0,0 +1,9 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011-2018 Ben Kurtovic <ben.kurtovic@gmail.com>
# Released under the terms of the MIT License. See LICENSE for details.

from .script import run

if __name__ == "__main__":
run()

+ 3
- 1
gitup/script.py Datei anzeigen

@@ -7,6 +7,7 @@ from __future__ import print_function

import argparse
import os
import platform
import sys

from colorama import init as color_init, Fore, Style
@@ -84,7 +85,8 @@ def main():
'-h', '--help', action="help", help="show this help message and exit")
group_m.add_argument(
'-v', '--version', action="version",
version="gitup " + __version__)
version="gitup {0} (Python {1})".format(
__version__, platform.python_version()))

# TODO: deprecated arguments, for removal in v1.0:
parser.add_argument(


+ 10
- 2
gitup/update.py Datei anzeigen

@@ -7,6 +7,8 @@ from __future__ import print_function

from glob import glob
import os
import pipes
import re
import shlex

from colorama import Fore, Style
@@ -77,8 +79,14 @@ def _fetch_remotes(remotes, prune):
try:
results = remote.fetch(progress=_ProgressMonitor(), prune=prune)
except exc.GitCommandError as err:
msg = err.command[0].replace("Error when fetching: ", "")
if not msg.endswith("."):
# We should have to do this ourselves, but GitPython doesn't give
# us a sensible way to get the raw stderr...
msg = re.sub(r"\s+", " ", err.stderr).strip()
msg = re.sub(r"^stderr: *'(fatal: *)?", "", msg).strip("'")
if not msg:
command = " ".join(pipes.quote(arg) for arg in err.command)
msg = "{0} failed with status {1}.".format(command, err.status)
elif not msg.endswith("."):
msg += "."
print(":", RED + "error:", msg)
return


Laden…
Abbrechen
Speichern