diff --git a/vcstranslator_project/apps/translator/tests.py b/vcstranslator_project/apps/translator/tests.py index bb0d94c..352968b 100644 --- a/vcstranslator_project/apps/translator/tests.py +++ b/vcstranslator_project/apps/translator/tests.py @@ -72,6 +72,7 @@ def test_hg_to_git(self): self.assert_translates(t, "record", "git add -p && git commit") self.assert_translates(t, "log", "git log --all") self.assert_translates(t, "", "git") + self.assert_translates(t, "outgoing", "git log origin..HEAD") def test_git_to_hg(self): t = Translator("git", "hg") diff --git a/vcstranslator_project/apps/translator/utils.py b/vcstranslator_project/apps/translator/utils.py index 7cb0fe3..09a1b8d 100644 --- a/vcstranslator_project/apps/translator/utils.py +++ b/vcstranslator_project/apps/translator/utils.py @@ -126,6 +126,8 @@ def translate_status(self, command): return "git status" def translate_log(self, command): + if command.outgoing: + return "git log origin..HEAD" if command.files is not command.ALL or command.branches is not command.ALL: return return "git log --all" @@ -163,6 +165,8 @@ def parse(self, command): return Status() elif parts == ["log"]: return Log(branches=Log.ALL, files=Log.ALL) + elif parts == ["outgoing"]: + return Log(branches=Log.ALL, files=Log.ALL, outgoing=True) elif parts[0] == "revert" and len(parts) == 2: return Revert(files=[SomeFile(parts[1])]) @@ -360,9 +364,10 @@ def __init__(self, verbose): self.verbose = verbose class Log(Command): - def __init__(self, branches, files): + def __init__(self, branches, files, outgoing=False): self.branches = branches self.files = files + self.outgoing = outgoing class Help(Command): def __init__(self, useless=False):