Commit Graph

930 Commits

Author SHA1 Message Date
Jarek Kobus
c5668952ae GitBaseDiffEditorController: Simplify internals
Remove initialize() method and do it inside reloader method.
When reloader is being executed the workingDirectory is already
set.

Amends bfcd1149eb

Change-Id: I600daaff8d15f3bdb822789623947b31df0b7edd
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-12-14 12:54:09 +00:00
Jarek Kobus
cbcfc0242e FileListDiffController: Reuse task tree
This makes it possible that staged and unstaged
tasks are run in parallel, so the result is to be
expected earlier.

Change-Id: I0b99d17a55e39f2178d6ebed208e29fbaaa8aa5e
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-12-14 12:53:47 +00:00
Jarek Kobus
13c7283c0e GitBaseDiffEditorController: Remove interactive branch expansion
Branches are now being automatically expanded.

Change-Id: I6c8986f39fe0ceb71841a2fea46b6038123240b7
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-12-14 10:22:00 +00:00
Jarek Kobus
85b645f144 ShowController: Make showing branches a part of show process
Change-Id: I23d994fd489fc6a6f02419452ad2b07c756a9cd3
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-12-14 10:21:53 +00:00
Jarek Kobus
eef9cb458b DiffEditorController: Make it possible to setup task tree
Instead of reloader function. Use task tree for ShowController.
Make diff processing a part of task tree.

Change-Id: I732d0a14eaf8de7ce0d1be891fb4700b22ea24b7
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-12-14 10:21:44 +00:00
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
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
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
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
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
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
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
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
Jarek Kobus
f4233a1c22 VcsCommand: Change the default logic for fully sync
Remove VcsCommand::FullySynchronous flag.
Rename VcsCommand::NoFullySync into UseEventLoop.
By default the command will run fully synchronous
(i.e. without nested event loop). Only when
UseEventLoop is specified, and the command runs in
main thread, the nested event loop will be used.

This change should preserve the current behavior
on all code paths.

Change-Id: Id4bbaf68402ceed5e3fcc6f294521e87eb0b8d4d
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-10-05 17:10:04 +00:00
Jarek Kobus
c666c93882 VcsBasePlugin: Use more FilePath
Change-Id: I7bc80245b093b210439efdf3ea353b52b288dcc0
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-10-04 11:51:20 +00:00
Jarek Kobus
38b19bfae6 DiffEditor: Cleanup includes
Change-Id: Id8127b9b0c99ee2a0d5d367cb551a1d5779c5d38
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-09-29 15:15:12 +00:00
Jarek Kobus
29ecc7b5dd VcsCommand: Rename execute() to start()
In order to conform to QtcProcess API.

Change-Id: I71fcc03846f32cd3c2df39824ce3f6730c20ebbb
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-09-21 05:33:46 +00:00
Jarek Kobus
b795bd8042 VcsPlugin: Use VcsCommand::done() signal instead of finished()
Conform to QtcProcess interface. Use result() when needed.

Change-Id: Idd4c71d9a103e8649b08ec7787c2f286423a31ec
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-09-20 10:41:35 +00:00
Jarek Kobus
012de6b4c3 PushHandler: Use cleanedStdErr()
Instead of connecting to stdErrText() signal.

Change-Id: Ib9fb94ca3fb0b5cbf4871e0ea3b06a047c31d272
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-09-20 10:41:06 +00:00
Jarek Kobus
d78ccc30cb ConflictHandler: Use cleanedStdOut() and cleanedStdErr()
Instead of connecting to stdOutText() and stdErrText() signals.

Change-Id: I3a90fe2a6b17eb804dbd67691a4685e236232456
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-09-20 10:29:51 +00:00
Jarek Kobus
eda8a4244f GitBaseDiffEditorController: Use cleanedStdOut()
Instead of connecting to stdOutText() signal.

Change-Id: Ia9d1d38934e254a8824620947a409fc52f7f531f
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-09-19 10:31:45 +00:00
Jarek Kobus
6d6346044c VcsBase: Rename vcsFullySynchronousExec into vcsSynchronousExec
Get rid of original vcsSynchronousExec(), as it was calling
vcsFullySynchronousExec().

Change-Id: I911dc786d54c34c211d03661c37df9b58d60a20b
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-09-02 13:46:12 +00:00
Jarek Kobus
6f3c03f1f9 GitClient: Replace for-each-ref command with QtcProcess
There is no need to use VcsCommand when NoOutput is passed.
Get rid of asyncForEachRefCmd().

Change-Id: I91b2226c365c7ce374eccc4884aba7aab5158cb2
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-09-01 16:35:51 +00:00
Jarek Kobus
66bfdffe0c GitClient: Replace describe command with QtcProcess
There is no need to use VcsCommand when NoOutput is passed.
Get rid of execBgCommand().

Change-Id: I58354e99ddc0c4049325560022ba6e755092b817
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-09-01 16:35:41 +00:00
Jarek Kobus
4e74e2aa03 GitClient: Replace rev-list command with QtcProcess
There is no need to use VcsCommand when NoOutput is passed.
Get rid of asyncUpstreamStatus().

Change-Id: Iae6869be9640c7662545906d28314ac47cd69e3d
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-09-01 15:55:41 +00:00
Lucie Gérard
a7956df3ca Use SPDX license identifiers
Replace the current license disclaimer in files by
a SPDX-License-Identifier.

Task-number: QTBUG-67283
Change-Id: I708fd1f9f2b73d60f57cc3568646929117825813
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-08-26 12:27:18 +00:00
Orgad Shaneh
45aa6a12c4 Git: Support user configured comment character
Task-number: QTCREATORBUG-28042
Change-Id: I96aea27434ba138637728a7fd7d1450e1eee260a
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2022-08-26 10:41:27 +00:00
Jarek Kobus
a50afa486a VcsCommand: Remove unused SshPasswordPrompt
Change-Id: I402d619656d8339b1e81bc9ae96acf56178505d2
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-08-26 08:36:34 +00:00
Eike Ziller
025bdfe702 VCS: Use qtcEnvironmentVariable* instead of qEnvironmentVariable*
And instead of qgetenv.
Takes Qt Creator's setting at "Environment > System > Environment" into
account, which makes it easier on some platforms to set them (e.g.
macOS), can be configured differently in different settings paths, and
potentially can be changed at runtime (depending on usage).

Change-Id: I364e5b663353f37121279a58f4a9fd514cddbbf0
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-08-26 08:03:01 +00:00
Jarek Kobus
278589a014 GitClient: Reuse VcsCommand::NoOutput
Change-Id: If30d78a34ae77a7397af6374f8b733809ecaab20
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-08-26 06:38:38 +00:00
David Schulz
c10f23a5c6 Git: add shortcuts to uncommitted changes dialog
Change-Id: Ifde8158b7902fb6a280545349ab8d8c0a723782c
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-08-26 06:05:12 +00:00
Marcus Tillmanns
04205d1225 FileUtils: Adds toFilePathList function
Change-Id: Ie3137751135fdb6c3161cc886f307323fcce6b72
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-08-04 11:33:53 +00:00
Jarek Kobus
4edb238073 VcsOutputWindow: Use FilePath for repository
Change-Id: Ie6669c94a1fa29e48524b9338e74413bb0830229
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-08-03 12:23:52 +00:00
Jarek Kobus
7bd33bc247 VcsCommand: Remove defaultWorkingRepository() getter
It wasn't really broadly used.

Change-Id: If2e185a7d8d0f920f3ec7f507bf96dd81f4559b0
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-08-03 11:30:36 +00:00
Jarek Kobus
191fc196d5 VcsCommand: Remove one addJob overload
Remove defaultTimeoutS field, as it wasn't broadly used.

Change-Id: I0056788b066eb6d682d5ba7acdb01d5dd3568967
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-08-03 06:09:44 +00:00
Jarek Kobus
0a7f76ca8d VcsCommand: Get rid of setCookie()
Remove cookie arg from finished() signal, as it's not used
currently. Thus, remove setCookie() method.

Change-Id: Iedd328aece776eebd2d161a36ec28370b8bc4bfc
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-08-02 09:00:01 +00:00
Jarek Kobus
2c51907b4b VcsCommand: Limit the usage of setCookie()
It looks like the cookie set inside GitClient::vcsExecAbortable()
is never read back again. The only place where we connect to
finished() signal of the command returned by vcsExecAbortable()
is GitClient::pull(), however, we ignore the cookie there.

Change-Id: Iaec08b255309ea406e45695231fe9849d5dc7285
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-08-02 08:59:56 +00:00