Commit Graph

827 Commits

Author SHA1 Message Date
Andre Hartmann
31e9c93b6b Git: Show upstream status for tracked branches
The Branch View now shows how many commmits
a branch is ahead and behind its tracking
branch.

Example:

  master ↑1 ↓15 [origin/master]

Change-Id: I9564efdfe82154cd98b9856313170aacad036f0c
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2019-12-24 08:12:03 +00:00
Miklós Márton
5ef320d9fc Git: Offer creating remote branch if push fails due to the lack of it
If git push fails because the remote branch does not exists a dialog
will be shown which will allow the creation of the remote branch without
leaving the IDE (by executing the git push --set-upstream .. command
suggested by the git itself).

Fixes: QTCREATORBUG-21154
Change-Id: Id785fdc64e27865fba2255eafd2043367a5835ea
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2019-12-19 22:38:20 +00:00
Andre Hartmann
00e04d5022 Git: Allow removing stale remote branches
... from the Branch View context menu on a
specific remote.

Change-Id: Ic7772abe32795a5d11bd4cae989f8d66cc4322e0
Reviewed-by: Miklós Márton <martonmiklosqdev@gmail.com>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2019-12-19 07:43:49 +00:00
Jarek Kobus
3b9ce98865 Git/DiffEditor: Fix staging added/removed lines separately
Fixes: QTCREATORBUG-23243
Change-Id: Ice19e1c778aabd9cb1b9fe0681234073de85cfcb
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2019-12-02 15:49:03 +00:00
Orgad Shaneh
cf8099f901 VCS: Replace addButton with addReloadButton
It's the only use, and this is a special option that deserves its own
function.

Change-Id: Ic69be5973b452d3a1d506fab3623d4a9b84f8452
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2019-11-24 16:22:27 +00:00
Andre Hartmann
1766832918 DiffEditor: Stage and unstage selected lines for Git
Fixes: QTCREATORBUG-19071
Change-Id: I560ba208e68e477ea865e499847d819cfdfeb6f3
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2019-11-19 11:19:43 +00:00
Christian Kandeler
b7395e97f3 Git: Speed up the unmanagedFiles() function
Given a list of files, we should not call git for every single one of
them to figure out which ones are part of the repository, because this
job can be done with a single call.
As a test case, I added my whole ~/dev directory with ca 600,000 source
files to a generic project. With this patch, the time spent on
retrieving the list of unmanaged files went down from nine hours to
seven seconds.

Task-number: QTCREATORBUG-20652
Change-Id: Ic04a2b973e14eff549a2642bde7bc269df069fd1
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2019-11-14 13:18:16 +00:00
Orgad Shaneh
4ae6c2a89b Git: Fix log for repo/project
Broke by ad6968f45f.

Change-Id: I06ff8384a088f6d9137b9711f855efa8d6bf4a74
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-09-24 07:00:17 +00:00
Orgad Shaneh
ad6968f45f Git: Add a toggle button for Follow Renames on Log
Fixes: QTCREATORBUG-22826
Change-Id: I6d5075dfe16bc3c5d0914dc182523f0295379396
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2019-09-05 08:18:11 +00:00
Sona Kurazyan
82bcf4e9f5 Remove usages of deprecated APIs
Replaced:
  QPalette::ColorRole::Background -> QPalette::ColorRole::Window
  QPalette::ColorRole::Foreground -> QPalette::ColorRole::WindowText
  Qt::ItemDataRole::TextColorRole -> Qt::ItemDataRole::ForegroundRole
  QFontMetrics::width() -> QFontMetrics::horizontalAdvance()

Task-number: QTBUG-76491
Change-Id: I1302e6b569e725daa6f7be1428ffe055657fc644
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-09-03 09:15:30 +00:00
Christian Kandeler
df8ef72aec Wizards: Do some input validation on repository URLs
Fixes: QTCREATORBUG-18935
Change-Id: Ie2103cbe2899ea23caaedd4a6350c78b5f380ab9
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2019-07-26 10:41:03 +00:00
hjk
8b72e92167 Utils: Add CommandLine convenience constructors
... taking a QString for the executable.

This weakens the very explicit QString -> FileName conversion via the
named constructors for the special case of constructing a CommandLine.

I think that's worthwhile here, as it reduces the noise on the caller
site under circumstance where the nature of the thing is obvious.

Change-Id: I27b4a73639728893d053b2e7ba65cb745f0ffe83
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-07-23 15:51:45 +00:00
Tim Jenssen
1df6443d4a Merge remote-tracking branch 'origin/4.10'
Conflicts:
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri
	src/libs/utils/synchronousprocess.cpp
	src/plugins/baremetal/iarewtoolchain.cpp
	src/plugins/cmakeprojectmanager/cmakeproject.cpp
	tests/unit/unittest/CMakeLists.txt

Change-Id: I124ad492df403286751e175d27fe36487ddf6d07
2019-07-04 15:17:55 +02:00
hjk
6a58666f44 More Utils::toSet/toList
... and unrelated cosmetic changes.

Change-Id: I591b17fd5289831e701b683f8fb47816efd1fa67
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-07-04 12:28:38 +00:00
Andre Hartmann
b950936d45 Git: Correctly handle aborting pull commands
For example, aborting a "git pull --rebase" command
did not work, because the old code tried to run
"git pull --abort" instead of "git rebase --abort".

As side effect, this patch also enables the Skip commit
button in handleMergeConflicts(), that was not shown
before.

Change-Id: Ifa43a4ba0199c97fdf8a361eb9e0207704d93e26
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2019-07-02 11:04:54 +00:00
Orgad Shaneh
a1ba347fa5 Git: Fix popping of branch-stash after checkout
Checking out a branch that has a saved stash, when
Pop branch stash is checked, is broken since checkout
became asynchronous.

We must wait for checkout to complete before popping
the branch stash.

Change-Id: Ia4d43649e742ced0121ffe106986b4d6ed1e7b38
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2019-07-01 19:57:02 +00:00
hjk
00b692e67e Utils: Use CommandLine in ShellCommand
... and adapt users.

Change-Id: I218523ffe34720d5fe199aa0ca6892a8dc2985fc
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2019-06-11 11:01:16 +00:00
Tasuku Suzuki
578cdf7c5a Git: Archive support
This allows users to create archive files from local repository.

Tools > Git > Local Repository > Archive will create <reponame>-
HEAD.tar.gz

Tools > Git > Actions on Commits... you can choose a commit to archive

Change-Id: I09bbbdefe532237e9065d1ca3c21910a036ea149
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Tasuku Suzuki <tasuku.suzuki@qbc.io>
2019-06-10 18:19:57 +00:00
hjk
473a741c9f Utils: Rename FileName to FilePath
More in line with QFileInfo terminonlogy which appears to be
best-of-breed within Qt.

Change-Id: I1d051ff1c8363ebd4ee56376451df45216c4c9ab
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-05-28 12:23:26 +00:00
hjk
1e9636ab8a Some more FileName::appendPath() -> pathAppended() changes
Change-Id: Ie494f7ae8a96d97c9497b3ef38d774d2cf787b7f
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-05-17 07:46:56 +00:00
Orgad Shaneh
1333b695d4 Git: Suggest to force-push on non-fast-forward failure
Fixes: QTCREATORBUG-21630
Change-Id: I31564d3909a1e3a3a66daf58323952944d5847f9
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2019-05-02 07:47:40 +00:00
Andre Hartmann
0161729c23 Git: Add tags from log window
Fixes: QTCREATORBUG-22202
Change-Id: Id6cbaf036d25fe5e9e8fcf2fe4d131649746e128
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2019-04-03 19:44:11 +00:00
Orgad Shaneh
a87481c5ec Git: Show success message after reset
Change-Id: Icbc731b9b529095e2b8fe0774bfd7eac6455da26
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2019-03-28 08:18:14 +00:00
Orgad Shaneh
b26febac83 Git: Suppress command logging for "log" in fixup commit editor
Change-Id: Ib4aee0a38f0e1cf8d2bdf1ae4884f8e75dbb5193
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2019-03-02 18:02:35 +00:00
Orgad Shaneh
17b3e45b8c VCS: Fix display of diff/show commands in progress bar
In 6ae0e8d2c7 we added 2 arguments that
precede the diff sub-command (-c diff.color=false).

When display name is not set, ShellCommand uses the binary followed by the
first argument, so it now showed "Git -c" instead of "Git Diff".

Change-Id: Ie584837bd87fd529e0cd015025fc3bf1a69d085c
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Xiaofeng Wang <wasphin@gmail.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-02-28 08:12:30 +00:00
Friedemann Kleint
963dc84cc5 Fix some deprecation warnings in basic plugins
Fix warnings apppearing in 5.13, for example:
warning: ‘QDir& QDir::operator=(const QString&)’ is deprecated: Use QDir::setPath() instead [-Wdeprecated-declarations]
...
warning: ‘static QRgb QColorDialog::getRgba(QRgb, bool*, QWidget*)’ is deprecated: Use getColor() [-Wdeprecated-declarations]
warning: ‘Qt::DropAction QDrag::start(Qt::DropActions)’ is deprecated: Use QDrag::exec() instead [-Wdeprecated-declarations]
warning: ‘void QProcess::finished(int)’ is deprecated: Use QProcess::finished(int, QProcess::ExitStatus) instead [-Wdeprecated-declarations]
...
warning: ‘const QRect QDesktopWidget::availableGeometry(int) const’ is deprecated: Use QGuiApplication::screens() [-Wdeprecated-declarations]
...
warning: ‘const QBrush& QPalette::background() const’ is deprecated: Use QPalette::window() instead [-Wdeprecated-declarations]
...
warning: ‘const QBrush& QPalette::foreground() const’ is deprecated: Use QPalette::windowText() instead [-Wdeprecated-declarations]
...
warning: ‘void QTextOption::setTabStop(qreal)’ is deprecated [-Wdeprecated-declarations]
warning: ‘void QList<T>::swap(int, int) [with T = ProjectExplorer::BuildStep*]’ is deprecated: Use QList<T>::swapItemsAt() [-Wdeprecated-declarations]
warning: ‘void QProcess::setReadChannelMode(QProcess::ProcessChannelMode)’ is deprecated: Use QProcess::setProcessChannelMode() instead [-Wdeprecated-declarations]
...
warning: ‘QString QFileInfo::readLink() const’ is deprecated: Use QFileInfo::symLinkTarget() instead [-Wdeprecated-declarations]

Change-Id: I1d893d42d372245892f2de8406f52dbe7bbd552a
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-02-11 09:32:06 +00:00
Xiaofeng Wang
6ae0e8d2c7 Git: set git config diff.color to false
With diff.color=true, which seems the default or frequently used option,
the patch will contains color info. DiffUtils cannot handle this. So,
just turn off this option explicitly.

Change-Id: I8d8fe972655bea4d638cb34b897346c5b11d5abc
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2019-01-30 04:44:15 +00:00
Orgad Shaneh
7096649fc2 Merge remote-tracking branch 'origin/4.8'
Change-Id: I5b18233936e3b2cd674df92a694ba73b5a3ed752
2018-12-03 09:56:07 +02:00
Orgad Shaneh
f5203796e4 Git: Use ICore::dialogParent as dialog parent
Change-Id: Idc3f2f4d27d3279f76b688fac635e8d38b2705f5
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-11-29 14:56:43 +00:00
Andre Hartmann
e65131ac11 Git: add svn dcommit
It's the counterpart to git push when working with
SVN remotes and git-svn.

Change-Id: I02257ea921fdcdedec294b28e8756ed88fb764b3
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2018-11-25 14:19:30 +00:00
Eike Ziller
3d1d9aae2e Merge remote-tracking branch 'origin/4.8'
Conflicts:
	src/plugins/winrt/winrtdevicefactory.cpp

Change-Id: I33b8697e2ebf2bea051d7f1144449e0743ee16a5
2018-11-19 10:00:18 +01:00
Orgad Shaneh
2f41f35952 Git: Make commit a bit less synchronous
If gc.auto is configured, commit can trigger garbage collection, which
takes time. Avoid completely blocking the UI on this case, and at least
show the output of the commit command.

Change-Id: Id301c878c26599bbc363928a6770c04369a62f2f
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-11-14 13:37:49 +00:00
Orgad Shaneh
92431932e3 Git: Show detached HEAD in branches view when applicable
Fixes: QTCREATORBUG-21311
Change-Id: Ia4297d23a965d83ea2814bd1e41f35a3017b8e9b
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-11-12 09:48:25 +00:00
Alessandro Portale
3b6f45a7a3 Git: Modernize
modernize-use-using
modernize-use-default-member-init
modernize-use-equals-default

Change-Id: Iaccd5611cfc2056d357a0545f8522f02d6f8f0ed
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2018-11-10 21:03:01 +00:00
Orgad Shaneh
fe87339888 Git: Fix resolving top level for non-existent sub-sub-directory
When a directory is renamed, and it has sub{sub-}*directories, executing
git blame on a file in the subdirectory -> Blame Revision (or parent) for
the file in the previous name -> Show failed because it couldn't determine
the top level directory.

You can test by opening qmakeprojectmanager/wizards/filespage.cpp and
blaming one of the lines that had it as qt4projectmanager/...

Change-Id: I7ac964c12f1f368c5ce92e9bedd972a2bc824935
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-10-25 17:52:28 +00:00
Orgad Shaneh
4c27b0e6e7 Git: Disable merge tool execution for vimdiff
vimdiff requires a terminal, which is not supported in Qt Creator.

Fixes: QTCREATORBUG-21147
Change-Id: I6168ac9c4a03061a64a1699fca6f39c90df5168b
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-10-11 10:42:19 +00:00
Orgad Shaneh
762fb5c353 Git: Make checkout asynchronous
It can be slow when many files are replaced.

Change-Id: I308698ef36973374f4526107fbda0d9ad907e707
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-10-10 08:30:16 +00:00
Andre Hartmann
3177e53804 Git: Add support for github remotes
Github and gitlab uses a different syntax when cloning with ssh:

 git@github.com:qt-creator/qt-creator.git

Support this pattern for remote validatation also.

Change-Id: Ic67f2238b9cdd526e76715c86846542cdb73f503
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2018-10-07 15:44:01 +00:00
Andre Hartmann
96f982a016 Git: Check remote port for isValid in GitRemote
Change-Id: Iab922abcde0ac055417467f3c63a31dffa721986
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2018-10-07 15:43:39 +00:00
Andre Hartmann
e79d68dab6 Git: Improve local file detection in GitRemote
* Make sure url has a proper size before accessing
  its elements
* Also check for valid drive letter before ':'

Change-Id: I958cbd492caa8a6ad4a5bf424277d8287f8cf0d4
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2018-10-02 19:42:18 +00:00
Orgad Shaneh
754fd66a0b Git: Suppress error messages for newly initialized repository
Change-Id: Ib7161e165fdf9cc2b1167b683e8e3dac17e0f1d6
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2018-09-29 16:51:45 +00:00
Orgad Shaneh
c415a03cea Git: Support move/copy detection for blame
Fixes: QTCREATORBUG-20462
Change-Id: Ib2ea14de6a60691a1ed27cd07aac282557d69015
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2018-09-19 20:16:23 +00:00
Orgad Shaneh
202d40f256 Git: Modernize
* Use auto
* Use override
* Use some member initializers

Change-Id: I3ca000d1c8e4d02331d58b85e68e4d771c636b29
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2018-09-19 19:47:07 +00:00
Orgad Shaneh
296ae92853 Git: Change pull to run asynchronously
Fixes: QTCREATORBUG-13279
Change-Id: Idee6e64e5eebe729e7c1d0e0135a1d8b464187b7
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2018-09-19 17:02:24 +00:00
Orgad Shaneh
760e6a9b13 Git: Fix launching of gitk when not in PATH
Tries the following:
* <git binary path>/gitk
* If git path ends with bin [or usr/bin, or mingw*/bin], try ../[../]cmd
* Search gitk in the PATH

Task-number: QTCREATORBUG-1577
Change-Id: I7f5e3d490bfeb527e2a5c1720126f1345e07eee0
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-09-04 09:33:25 +00:00
Andre Hartmann
495356ce9d Git: Fix remote detection for local remotes starting with "file://"
Task-number: QTCREATORBUG-20618
Change-Id: I21cddf88b64fa7a6acdc92228142976284ef8942
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2018-07-30 13:23:38 +00:00
Orgad Shaneh
943f499fe4 Git: Silence managesFile
When adding existing untracked files to a project, and choosing to add them
to Git, error messages appeared in the output pane.

Change-Id: Iba639a678d2ca424fb32b34b218fca1c4b99971d
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-07-09 09:33:20 +00:00
Nikolai Kosjar
b2f8ffdb20 Git: Fix handling Esc in "Create Local Branch" dialog
Change-Id: I8415e7ffcdbeb648b28273aa5791144e95f63de9
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2018-05-31 12:14:01 +00:00
Eike Ziller
428fcb476b Merge remote-tracking branch 'origin/4.6'
Conflicts:
	src/libs/utils/settingsaccessor.cpp
	src/plugins/autotest/autotestplugin.cpp
	src/plugins/git/gitclient.cpp
	src/plugins/qbsprojectmanager/qbsrunconfiguration.cpp
	src/plugins/qbsprojectmanager/qbsrunconfiguration.h

Change-Id: I65f143cad18af509a2621d6c5925abbd038ea70f
2018-04-13 10:54:42 +02:00
Jarek Kobus
e806ea40cc Pass this context object to the connect()
Otherwise when "this" instance
gets deleted and the sender still exists, the lambda
expression is still invoked for the deleted object.

Task-number: QTCREATORBUG-20223
Change-Id: Ifd5c9e6ce1fe7fde71698c6683cdfcd7566e8d35
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2018-04-09 09:31:40 +00:00