From 9bc9fe73e160f9ef87979a3cf5f1276b5f1ae0cf Mon Sep 17 00:00:00 2001 From: dt Date: Tue, 11 May 2010 14:13:38 +0200 Subject: File renaming Reviewed-By: con Reviewed-By: Friedemann Kleint We now support renaming files. The version control system tries first to rename, if that doesn't support or can't rename the file we do a normal rename. (Note: git, hg, perforce > 2009.02 support renaming, cvs not. (perforce untested)). We correctly notify all editors of the renamed file and tell the project manager to rename the file in the project. Note: Only the qt4projectmanager knows how to rename files. Note: renaming folders, moving files to different folders, renaming .pro/.pri files is not supported. Those things can be later added after this has proven to work correctly in the simple case. Also we don't do any actions based on the renaming like renaming classes, changing include guards or #include lines. --- src/plugins/git/gitversioncontrol.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/plugins/git/gitversioncontrol.cpp') diff --git a/src/plugins/git/gitversioncontrol.cpp b/src/plugins/git/gitversioncontrol.cpp index 07ff952134..65a46e492e 100644 --- a/src/plugins/git/gitversioncontrol.cpp +++ b/src/plugins/git/gitversioncontrol.cpp @@ -75,6 +75,9 @@ bool GitVersionControl::supportsOperation(Operation operation) const case DeleteOperation: rc = true; break; + case MoveOperation: + rc = true; + break; case OpenOperation: break; case CreateRepositoryOperation: @@ -107,6 +110,13 @@ bool GitVersionControl::vcsDelete(const QString & fileName) return gitClient()->synchronousDelete(fi.absolutePath(), true, QStringList(fi.fileName())); } +bool GitVersionControl::vcsMove(const QString &from, const QString &to) +{ + const QFileInfo fromInfo(from); + const QFileInfo toInfo(to); + return gitClient()->synchronousMove(fromInfo.absolutePath(), fromInfo.absoluteFilePath(), toInfo.absoluteFilePath()); +} + bool GitVersionControl::vcsCreateRepository(const QString &directory) { return gitClient()->synchronousInit(directory); -- cgit v1.2.1