[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kdevplatform/1.7] /: Restore upload functionality to git.reviewboard.kde.org
From: René J.V. Bertin <rjvbertin () gmail ! com>
Date: 2014-12-31 18:06:08
Message-ID: E1Y6Neq-00063D-Cp () scm ! kde ! org
[Download RAW message or body]
Git commit f1b7c7bafc0b3a9a41838395bf6a21dd184a06b1 by René J.V. Bertin.
Committed on 31/12/2014 at 18:05.
Pushed by rjvbb into branch '1.7'.
Restore upload functionality to git.reviewboard.kde.org
BUG:341875
REVIEW:121586
M +8 -2 plugins/git/gitplugin.cpp
M +14 -0 plugins/git/gitplugin.h
M +1 -0 plugins/patchreview/patchreview.cpp
M +1 -1 plugins/reviewboard/reviewboardjobs.cpp
M +1 -0 plugins/reviewboard/reviewboardplugin.cpp
M +14 -29 vcs/vcsdiff.cpp
M +9 -3 vcs/vcsdiff.h
M +6 -1 vcs/widgets/vcsdiffpatchsources.cpp
M +3 -0 vcs/widgets/vcsdiffpatchsources.h
http://commits.kde.org/kdevplatform/f1b7c7bafc0b3a9a41838395bf6a21dd184a06b1
diff --git a/plugins/git/gitplugin.cpp b/plugins/git/gitplugin.cpp
index f38dc71..0883352 100644
--- a/plugins/git/gitplugin.cpp
+++ b/plugins/git/gitplugin.cpp
@@ -175,7 +175,7 @@ QDir urlDir(const KUrl::List& urls) { return \
urlDir(urls.first()); } //TODO: cou }
GitPlugin::GitPlugin( QObject *parent, const QVariantList & )
- : DistributedVersionControlPlugin(parent, KDevGitFactory::componentData()), \
m_oldVersion(false) + : DistributedVersionControlPlugin(parent, \
KDevGitFactory::componentData()), m_oldVersion(false), m_usePrefix(true) {
if (KStandardDirs::findExe("git").isEmpty()) {
m_hasError = true;
@@ -354,7 +354,12 @@ VcsJob* GitPlugin::diff(const KUrl& fileOrDirectory, const \
KDevelop::VcsRevision
DVcsJob* job = new GitJob(dotGitDirectory(fileOrDirectory), this, \
KDevelop::OutputJob::Silent); job->setType(VcsJob::Diff);
- *job << "git" << "diff" << "--no-prefix" << "--no-color" << "--no-ext-diff";
+ *job << "git" << "diff" << "--no-color" << "--no-ext-diff";
+ if (!usePrefix()) {
+ // KDE's ReviewBoard now requires p1 patchfiles, so `git diff --no-prefix` \
to generate p0 patches + // has become optional.
+ *job << "--no-prefix";
+ }
if(srcRevision.revisionType()==VcsRevision::Special
&& dstRevision.revisionType()==VcsRevision::Special
&& srcRevision.specialType()==VcsRevision::Base
@@ -1065,6 +1070,7 @@ void GitPlugin::parseGitDiffOutput(DVcsJob* job)
VcsDiff diff;
diff.setDiff(job->output());
diff.setBaseDiff(repositoryRoot(KUrl(job->directory().absolutePath())));
+ diff.setDepth(usePrefix()? 1 : 0);
job->setResults(qVariantFromValue(diff));
}
diff --git a/plugins/git/gitplugin.h b/plugins/git/gitplugin.h
index e930423..4a81730 100644
--- a/plugins/git/gitplugin.h
+++ b/plugins/git/gitplugin.h
@@ -144,6 +144,19 @@ public:
virtual void registerRepositoryForCurrentBranchChanges(const KUrl& repository);
KDevelop::CheckInRepositoryJob* isInRepository(KTextEditor::Document* document);
+
+ // this indicates whether the diff() function will generate a diff (patch) which
+ // includes the working copy directory name or not (in which case git diff is \
called + // with --no-prefix).
+ bool usePrefix() const
+ {
+ return m_usePrefix;
+ }
+
+ void setUsePrefix(bool p)
+ {
+ m_usePrefix = p;
+ }
protected:
KUrl repositoryRoot(const KUrl& path);
@@ -202,6 +215,7 @@ private:
QString m_errorDescription;
KDirWatch* m_watcher;
KUrl::List m_branchesChange;
+ bool m_usePrefix;
};
QVariant runSynchronously(KDevelop::VcsJob* job);
diff --git a/plugins/patchreview/patchreview.cpp \
b/plugins/patchreview/patchreview.cpp index 18b63db..7a1ce86 100644
--- a/plugins/patchreview/patchreview.cpp
+++ b/plugins/patchreview/patchreview.cpp
@@ -552,6 +552,7 @@ void PatchReviewPlugin::exporterSelected( QAction* action ) {
if( exporter ) {
qDebug() << "exporting patch" << exporter << action->text();
+ // for git projects, m_patch will be a VCSDiffPatchSource instance
exporter->extension<IPatchExporter>()->exportPatch( patch() );
}
}
diff --git a/plugins/reviewboard/reviewboardjobs.cpp \
b/plugins/reviewboard/reviewboardjobs.cpp index 96cb354..4917cd7 100644
--- a/plugins/reviewboard/reviewboardjobs.cpp
+++ b/plugins/reviewboard/reviewboardjobs.cpp
@@ -132,7 +132,7 @@ void HttpCall::start()
connect(m_reply, SIGNAL(finished()), SLOT(finished()));
- qDebug() << "starting..." << m_requrl << m_post;
+ qDebug() << "starting... requrl=" << m_requrl << "post=" << m_post;
}
QVariant HttpCall::result() const
diff --git a/plugins/reviewboard/reviewboardplugin.cpp \
b/plugins/reviewboard/reviewboardplugin.cpp index 1dd3bcb..4d7dbfa 100644
--- a/plugins/reviewboard/reviewboardplugin.cpp
+++ b/plugins/reviewboard/reviewboardplugin.cpp
@@ -123,6 +123,7 @@ void ReviewBoardPlugin::reviewCreated(KJob* j)
{
if (j->error()==0) {
ReviewBoard::NewRequest const * job = \
qobject_cast<ReviewBoard::NewRequest*>(j); + // for git projects, m_source \
will be a VCSDiffPatchSource instance
ReviewBoard::SubmitPatchRequest* submitPatchJob=new \
ReviewBoard::SubmitPatchRequest(job->server(), m_source->file(), m_baseDir, \
job->requestId());
connect(submitPatchJob, SIGNAL(finished(KJob*)), SLOT(reviewDone(KJob*)));
submitPatchJob->start();
diff --git a/vcs/vcsdiff.cpp b/vcs/vcsdiff.cpp
index 01eb73c..dc5d352 100644
--- a/vcs/vcsdiff.cpp
+++ b/vcs/vcsdiff.cpp
@@ -36,8 +36,9 @@ public:
QHash<VcsLocation,QString> rightTexts;
KUrl baseDiff;
QString diff;
- VcsDiff::Type type;
- VcsDiff::Content content;
+ VcsDiff::Type type = VcsDiff::DiffDontCare;
+ VcsDiff::Content content = VcsDiff::Text;
+ uint depth = 0;
};
VcsDiff::VcsDiff()
@@ -53,14 +54,7 @@ VcsDiff::~VcsDiff()
VcsDiff::VcsDiff( const VcsDiff& rhs )
: d(new VcsDiffPrivate)
{
- d->leftBinaries = rhs.d->leftBinaries;
- d->rightBinaries = rhs.d->rightBinaries;
- d->leftTexts = rhs.d->leftTexts;
- d->rightTexts = rhs.d->rightTexts;
- d->diff = rhs.d->diff;
- d->type = rhs.d->type;
- d->content = rhs.d->content;
- d->baseDiff = rhs.d->baseDiff;
+ *d = *rhs.d;
}
bool VcsDiff::isEmpty() const
@@ -163,16 +157,9 @@ void VcsDiff::setContentType( VcsDiff::Content c )
VcsDiff& VcsDiff::operator=( const VcsDiff& rhs)
{
- if(this == &rhs)
- return *this;
- d->content = rhs.d->content;
- d->type = rhs.d->type;
- d->leftBinaries = rhs.d->leftBinaries;
- d->rightBinaries = rhs.d->rightBinaries;
- d->leftTexts = rhs.d->leftTexts;
- d->rightTexts = rhs.d->rightTexts;
- d->diff = rhs.d->diff;
- d->baseDiff = rhs.d->baseDiff;
+ if (this != &rhs) {
+ *d = *rhs.d;
+ }
return *this;
}
@@ -181,21 +168,19 @@ KUrl VcsDiff::baseDiff() const
return d->baseDiff;
}
+uint VcsDiff::depth() const
+{
+ return d->depth;
+}
+
void VcsDiff::setBaseDiff(const KUrl& url) const
{
d->baseDiff=url;
}
-void VcsDiff::clear()
+void VcsDiff::setDepth(const uint depth) const
{
-// d->content;
-// d->type;
- d->leftBinaries.clear();
- d->rightBinaries.clear();
- d->leftTexts.clear();
- d->rightTexts.clear();
- d->diff.clear();
- d->baseDiff.clear();
+ d->depth = depth;
}
diff --git a/vcs/vcsdiff.h b/vcs/vcsdiff.h
index 573ec1b..e4aa730 100644
--- a/vcs/vcsdiff.h
+++ b/vcs/vcsdiff.h
@@ -103,9 +103,17 @@ public:
/** @returns the base directory of the diff. */
KUrl baseDiff() const;
-
+
+ /**
+ * Depth - number of directories to left-strip from paths in the patch - see "patch \
-p" + * Defaults to 0
+ */
+ uint depth() const;
+
/** Sets the base directory of the diff to the @p url */
void setBaseDiff(const KUrl& url) const;
+ /** Sets the depth of the diff to @p depth */
+ void setDepth(const uint depth) const;
void setDiff( const QString& );
void addLeftBinary( const KDevelop::VcsLocation&, const QByteArray& );
@@ -125,8 +133,6 @@ public:
/** @returns whether there are not changes on the diff */
bool isEmpty() const;
- /** Clears the diff information and it becomes an empty patch. */
- void clear();
private:
class VcsDiffPrivate* const d;
};
diff --git a/vcs/widgets/vcsdiffpatchsources.cpp \
b/vcs/widgets/vcsdiffpatchsources.cpp index c3e2dae..195b9b6 100644
--- a/vcs/widgets/vcsdiffpatchsources.cpp
+++ b/vcs/widgets/vcsdiffpatchsources.cpp
@@ -164,6 +164,10 @@ QString VCSDiffPatchSource::name() const {
return m_name;
}
+uint VCSDiffPatchSource::depth() const {
+ return m_depth;
+}
+
void VCSDiffPatchSource::updateFromDiff(VcsDiff vcsdiff)
{
if(!m_file.isValid())
@@ -189,7 +193,8 @@ void VCSDiffPatchSource::updateFromDiff(VcsDiff vcsdiff)
m_name = "VCS Diff";
m_base = vcsdiff.baseDiff();
m_base.addPath("/");
-
+ m_depth = vcsdiff.depth();
+
emit patchChanged();
}
diff --git a/vcs/widgets/vcsdiffpatchsources.h b/vcs/widgets/vcsdiffpatchsources.h
index 6a2f934..2ee275c 100644
--- a/vcs/widgets/vcsdiffpatchsources.h
+++ b/vcs/widgets/vcsdiffpatchsources.h
@@ -77,6 +77,8 @@ class KDEVPLATFORMVCS_EXPORT VCSDiffPatchSource : public \
KDevelop::IPatchSource
virtual QString name() const ;
+ virtual uint depth() const ;
+
virtual void update() ;
virtual bool isAlreadyApplied() const { return true; }
@@ -90,6 +92,7 @@ class KDEVPLATFORMVCS_EXPORT VCSDiffPatchSource : public \
KDevelop::IPatchSource QMap<KUrl, KDevelop::VcsStatusInfo::State> m_selectable;
private:
void updateFromDiff(KDevelop::VcsDiff diff);
+ uint m_depth = 0;
};
class KDEVPLATFORMVCS_EXPORT VCSCommitDiffPatchSource : public VCSDiffPatchSource {
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic