From af80286a56f643da1446329406ae637563918c61 Mon Sep 17 00:00:00 2001 From: Thomas Zander Date: Fri, 12 Jun 2009 10:12:08 +0200 Subject: [PATCH] Allow passing of revision(s) on the command line of 'diff' --- src/commands/Diff.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/commands/Diff.cpp b/src/commands/Diff.cpp index 625d2df..7ea4e06 100644 --- a/src/commands/Diff.cpp +++ b/src/commands/Diff.cpp @@ -25,8 +25,6 @@ #include "WhatsNew.h" #include "Changes.h" -// #include -// #include #include static const CommandLineOption options[] = { @@ -72,7 +70,7 @@ AbstractCommand::ReturnCodes Diff::run() continue; } if (branchName == arg || (branchName.endsWith(arg) && branchName[branchName.length() - arg.length() - 1].unicode() == '/')) { - revisions = QLatin1String("HEAD ")+branch.commitTreeIsmSha1(); + revisions = branch.commitTreeIsmSha1() + QLatin1String(" HEAD"); break; } } @@ -81,6 +79,14 @@ AbstractCommand::ReturnCodes Diff::run() } } + if (revisions.isEmpty()) { + QStringList arguments = args->arguments(); + if (arguments.count() > 2) // first is the command + revisions = arguments.at(1) + QLatin1Char(' ') + arguments.at(2); + else if (arguments.count() > 1) + revisions = arguments.at(1) + QLatin1Char(' ') + QLatin1String("HEAD"); + } + const QStringList options = args->options(); // always use 'whatsnew' unless the user passes a patch options if (revisions.isEmpty() && !(options.contains(QLatin1String("to-match")) -- 2.11.4.GIT