Commit Graph

2257 Commits

Author SHA1 Message Date
Orgad Shaneh
72751a9b98 Git: Remove outdated comment
Missed in eb1226df68.

Change-Id: Ib5d6d11bdb563882a2a651b3e26a30f006af973d
Reviewed-by: hjk <hjk@qt.io>
2022-12-13 15:53:42 +00:00
Jarek Kobus
32e824c762 VcsBase: Don't return editor from annotate()
Take int firstLine as last arg instead. Switch the order of
3rd and 4th args as most callers provide lineNumber
and don't provide revision.

Change-Id: Iab60c1068a4d9829d10219af39bf3dcbf51e37bb
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-12-11 11:15:15 +00:00
Jarek Kobus
db85862a8c Git: Reuse handleResponse() inside vcsExecAbortable()
Remove ConflictHandler::attachToCommand().
Rename handleResponse() into handleConflictResponse() and
move it out of ConflictHandler class.

Change-Id: I0a64bd19f288d9377a93cdb5eea2c44b65bf6fdb
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-12-10 18:40:30 +00:00
Jarek Kobus
305dc46902 Git: Add CommandHandler into vcsExecAbortable
Don't return VcsCommand anymore.

Change-Id: I895951e8bd8d380d7b946380628e41b928c9b743
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-12-10 18:15:49 +00:00
Jarek Kobus
8d7ced7d83 VcsBase: Get rid of CommandOutputBindMode
Simplify createCommand() implementation. All callers
passed either non-null editor (in this case the
bindMode was always NoBind) or passed a null editor and one
of two values for bindMode (in this case the only
effect was to add (or not) a RunFlags::ShowStdOut flag).

Drop CommandOutputBindMode enum completely and pass
directly RunFlags::ShowStdOut when needed (i.e. in cases
we were passing CommandOutputBindMode::ToVcsWindow).

Change-Id: Ic3af05818933a03f615ba02267403b9f0bd326ba
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-12-09 13:24:34 +00:00
Jarek Kobus
112835922a VcsBase: Reuse CommandOutputBindMode instead of bool
Reuse it inside vcsExec() and vcsExecWithHandler().

Change-Id: I6ff4044bf43e0883fc46a49718f5f44da87a7e13
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-12-09 10:29:51 +00:00
Jarek Kobus
46213c82be GitClient: Simplify vcsExec
Get rid of editor arg.
Reorder last two args (to conform to vcsExecWithHandler).

Change-Id: Ia32757ac8b766640b76bef81f1b2e0f5efe4d48c
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-12-09 10:29:36 +00:00
Jarek Kobus
0cdfac0cb5 GitClient: Introduce execWithEditor()
Change-Id: I3a7edde4b978cb8e99fe0020d69a0a5e3e09c0fb
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-12-09 10:29:23 +00:00
Jarek Kobus
287a7c9268 VcsBase: Introduce vcsExecWithHandler()
Before, vcsExec() returned already started VcsCommand.
Later, callers of vcsExec() were establishing connections
to the retured VcsCommand::done() signal. However, when
process fails to start (e.g. because of non-existing
executable), the done() signal may be emitted synchonously
from inside VcsCommand::start(). In this scenario
callers of VcsCommand could miss the emission of done()
signal and connect to already finished command.

Instead, provide a vcsExecWithHandler() function which
takes a handler to be called when command finished.
In addition it takes the context object, too.
Don't return VcsCommand from vcsExec() anymore.

Change-Id: I2fb5fbe5d27632ea039c650d37e5d7d1b60cebc0
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-12-09 10:29:04 +00:00
Jarek Kobus
a6b17d127a VcsBase, Git: Don't use queued connections to VcsCommand
Otherwise, the destructor of VcsCommand could have been
executed in meantime (since it's invoked automatically
after done()) and we might access invalid pointer to the
command inside the done handler.

Change-Id: I031e2281952451d4e01c47f437097a1e7bf8899f
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-12-08 20:54:49 +00:00
Jarek Kobus
533d969735 GitClient: Remove unused connectRepositoryChanged()
It wasn't implemented, neither.

Change-Id: Ic6cdf70e10b232d326dcc936337a38488adca0ac
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-12-08 20:54:32 +00:00
Jarek Kobus
b67201c410 Git: Simplify ConflictHandler
Don't create QObject instance when handling conflicts.
Operate on static functions only.
Replace destructor of ConflictHandler with finalize() method.

Change-Id: If579edc6213faa50c73a90cedf4b67cf985478ac
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-12-08 13:46:59 +00:00
Jarek Kobus
c021fb5179 Don't call non-const methods on temporary QList
Otherwise it may unnecessarily detach. Either store a local
const reference or call const equivalent (e.g. constFirst()).

Change-Id: I96d665487cf28c17e72bea17f1b8f164ce06cc70
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-12-08 10:21:57 +00:00
Jarek Kobus
0313470db0 VcsBase: Pass context object to lambda connections
Remove some unneeded lambda () brackets.

Change-Id: I20e43625793401544e86efb627f5921c395026bb
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-12-07 21:54:39 +00:00
Andre Hartmann
8e5c84e3dd Git: Disable instant blame for modified files
Change-Id: Iae24a8bbcbdb3663367ee863e8cc27ad92942e17
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-11-28 14:37:11 +00:00
Orgad Shaneh
a2baeea394 Git: Enable instant blame only if current file is managed
If the current project is Git managed, but the user opens a header from an
unmanaged directory, don't try to run blame.

Change-Id: I563f7a687b2ea03f4c03bf97c8f5c27c1f8411ec
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2022-11-22 16:43:36 +00:00
Orgad Shaneh
3a7fee0cc6 Git: Fix crash when closing last editor
before instant blame was activated.

Change-Id: I8a8acf6dc58cb25f7c10c1dfa08e3b7f6bae3e76
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2022-11-21 15:53:13 +00:00
Orgad Shaneh
252179b938 Git: Stop blame attempts for unmanaged files in the repository
A file that is in the repository directory, but not managed by Git should
not attempt to run instant blame on every cursor change.

Change-Id: Ia7daa2ae9980cea4363e010a98fb1e2f2a3ec05f
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2022-11-21 15:49:56 +00:00
Andre Hartmann
4d63f2a598 Git: use unique_ptr for instant blame marks
Also simplifies the code.

Change-Id: I5da0aeb86ba5a28c9016cde11aab9dcee922d908
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2022-11-21 15:46:00 +00:00
Andre Hartmann
cae1936da3 Git: Add instant line annotation (blame)
Inspired by the Visual Studio Code plugin GitLens.

Add an annotation to the editor line the cursor
is  currently in. A tooltip contains the commit
data and allows to invoke git show for the commit.

When the automatic annotation is turned off, it can
still be forced for the current line with an action.
The default shortcut for this action is: Alt+G,Alt+I

Task-number: QTCREATORBUG-23299
Change-Id: I58eef9efcf531afb11470e5f5456e19f282b18d0
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-11-19 16:30:29 +00:00
Jarek Kobus
1f59f42287 Remove unused includes of QLayout
Change-Id: I12777e07f3d6fcc639b48f02080e73b1a0a3ea30
Reviewed-by: hjk <hjk@qt.io>
2022-11-18 15:29:35 +00:00
Jarek Kobus
3caf82f746 Remove unused includes of Q[H/V]BoxLayout
Change-Id: Ia90b30b634281414268e00722771470f1e7b69c0
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
2022-11-18 15:29:06 +00:00
Jarek Kobus
db76087213 Git: GerritPushDialog: Use Layouting
Change-Id: I5b0a95680e683cf6e5b938b4a4a74bfc0c5b45e2
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-11-18 09:11:00 +00:00
Jarek Kobus
1a70403f94 Remove unused includes of QFormLayout
Change-Id: Ia877cb57037342f2a7b332b29d9cb45e9b01c4bc
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2022-11-18 07:33:29 +00:00
hjk
30312cc74a Vcs: Proliferate FilePath a bit further
Change-Id: I8490917bf0bde59b1cef2509ec14c3ca985fa43d
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-11-09 15:08:19 +00:00
Eike Ziller
68388a38dd Merge remote-tracking branch 'origin/9.0'
Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri
	src/plugins/qmldesigner/components/edit3d/edit3dwidget.cpp

Change-Id: I154a9ababa9e166cb06e98652d481fe6234f6399
2022-11-03 13:44:37 +01:00
Orgad Shaneh
e61e92d016 Git: Fix focus issue in LogChangeWidget
Workaround QTBUG-89156.

Change-Id: Ia128db1c0c2ee85985b6a725b6cb849d87844668
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2022-10-27 10:08:10 +00:00
Orgad Shaneh
d63bfa4a29 VCS: Simplify submit editor accept/close flow
* Replace message box with an error on the output pane.
* Separate logic for accept and close.

Change-Id: Ib9fa201a1a67ee195086f7a22bc6678a9642452a
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2022-10-25 19:19:40 +00:00
Christian Kandeler
13f40f5471 Utils: Add sorted() function
For simpler calling code.

Change-Id: Ia0a16a28770fd172f74d06a626148248bf5d3c0c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-10-25 14:29:45 +00:00
Orgad Shaneh
1593f869ed VCS: Remove "Commit" option when closing commit editor
Fixes: QTCREATORBUG-22233
Change-Id: I1270cc58a823b919475fc51ac5fc71b892b379b6
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2022-10-21 13:13:59 +00:00
Eike Ziller
3bdb1a3edf Merge remote-tracking branch 'origin/9.0'
Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri
	src/plugins/qmldesigner/components/edit3d/edit3dwidget.cpp
	src/plugins/vcsbase/vcscommand.cpp

Change-Id: I2d33113bfb2ea7134550cda1de4e2c21e6711778
2022-10-18 16:51:36 +02:00
Orgad Shaneh
890b85d17e VCS: Simplify promptSubmit a bit more
+ fix regression for Git, which allowed to commit invalid commits.

Amends commit 9b61e484be.

Change-Id: I7571863bb982bfae1aa040e08f8c68010b14b147
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2022-10-18 06:31:53 +00:00
Orgad Shaneh
9b61e484be VCS: Deduplicate some submit editor closing logic
Change-Id: I622f5703c222a48606fcca3b99e87f9398e6a815
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2022-10-17 16:37:26 +00:00
Orgad Shaneh
eaad78547c VCS: Remove "Prompt to submit" settings
Task-number: QTCREATORBUG-22233
Change-Id: Ifbfd738281066af7913357ff9e2466a6c983452c
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2022-10-17 16:37:17 +00:00
Orgad Shaneh
7c25d1a895 Git: Pass only files after -- on Blame
It works, but is likely to break at some point.

Change-Id: I97952a7cb6cd3569adc694db7537fab807bda0ea
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2022-10-14 14:01:53 +00:00
Orgad Shaneh
8394bb0a2b Git: Improve tracking of external changes to HEAD
Instead of using FileSystemWatcher, emit repositoryChanged when
refreshTopic is called.

This reverts commit 2a8c48cb15.

Fixes: QTCREATORBUG-21089
Change-Id: Iaee8a895f3bc087583cbdea11c6dc2c263694a86
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2022-10-14 12:16:16 +00:00
Orgad Shaneh
424fd7c557 VCS: Resolve symlinks on blame
Fixes: QTCREATORBUG-20792
Change-Id: I60ac64957b23b80826c93ba73ff17a265549811f
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2022-10-14 11:32:14 +00:00
Orgad Shaneh
967e8cf260 Git: Respect text encoding in project settings on diff
Fixes: QTCREATORBUG-21794
Change-Id: Ib4be9811c0ab1cba5cad4adbfe740a6d99f420d1
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2022-10-14 11:21:17 +00:00
Orgad Shaneh
8c1cd7539c Git: Fix removing nested files
* Add -- before file list on add/remove.
* Run in the correct directory.

Fixes: QTCREATORBUG-27405
Change-Id: Ie04cd19981dac465cf70dba8b089fd18a4ecdf8b
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2022-10-11 15:32:13 +00:00
Orgad Shaneh
d2160e8b4f Git: Fix adding existing files in nested directories
Amends 48c56416f5.

Fixes: QTCREATORBUG-27644
Change-Id: I4ef58c017e4fcf8fa48905f7e0b649433b3cac0f
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2022-10-11 15:31:54 +00:00
Orgad Shaneh
82b2b2cae9 VCS: Fix misuses of parentDir().absolutePath()
absolutePath() *is* the parent directory.

Change-Id: I59f2c4ae65b265270d432f381258b95c65e53581
Reviewed-by: hjk <hjk@qt.io>
2022-10-11 13:49:50 +00:00
Orgad Shaneh
7c623f99d8 Git: Fix pattern for commit hash matching
* Avoid matching mid-word.
* Avoid matching after "mode ".
* Change to raw string literals.

Fixes: QTCREATORBUG-24768
Fixes: QTCREATORBUG-28268
Change-Id: I68abbf3de7928c60e0fe2d944adedaa6db94b1a4
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2022-10-11 10:00:53 +00:00
Jarek Kobus
93dfa93b7d VcsCommand: Simplify ProgressParser
Get rid of abstract base ProgressParser and replace
it with ProgressParser function. The only one former
subclass GitProgressParser is now functor object.
Pass future interface directly to the ProgressParser
function, along with input text to be parsed.

Change-Id: Icbcf0b6e55097f8b38eb8a32ceaa4414723116d0
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-10-07 14:52:14 +00:00
Marc Mutz
8eb4d52342 Port from qAsConst() to std::as_const()
We've been requiring C++17 since Qt 6.0, and our qAsConst use finally
starts to bother us (QTBUG-99313), so time to port away from it
now.

Since qAsConst has exactly the same semantics as std::as_const (down
to rvalue treatment, constexpr'ness and noexcept'ness), there's really
nothing more to it than a global search-and-replace.

Task-number: QTBUG-99313
Change-Id: I88edd91395849574436299b8badda21bb93bea39
Reviewed-by: hjk <hjk@qt.io>
2022-10-07 13:47:53 +00:00
Robert Löhning
fcb79ee810 Git: VcsBase: Squish: Make tst_git_local run again
Amends 1548eef10b
Amends 69f4cb86dd
Amends 9ad5c4254d
Amends e070d826e5

Change-Id: I584b1b9b662144899d0292b887e8cb3386f80d4b
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-10-07 08:33:12 +00:00
Christian Kandeler
708b119473 Git: Fix include directive
Change-Id: I35aff37fff00f020044c84ef288234146ebd5ade
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-10-07 04:29:29 +00:00
Alessandro Portale
928a7d2087 Git: Convert to Tr::tr
Change-Id: I7fb1753109a9263c70c01713f5f4895db6b73662
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-10-06 12:32:58 +00:00
Jarek Kobus
eec0679234 VcsBase: Move RunFlags into separate header
It is going to be used outside of VcsCommand, too.
Use RunFlags enum as an argument to several functions
instead of unsigned.

Change-Id: I355c80a845a9b5982108fbde3412754392dce702
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-10-06 12:00:35 +00:00
Robert Löhning
729805e7fd Git: Restore object names for dialog
Amends ffcf85958f

Change-Id: Ia48b114137d722df5f72add818d5729adff94110
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-10-06 07:48:45 +00:00
Jarek Kobus
64db0009d5 VcsManager: Use more FilePath
Change-Id: I255372c47e6d3ea55e5f8060c3c2fdd9bd155c75
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-10-05 18:25:33 +00:00