Commit Graph

542 Commits

Author SHA1 Message Date
hjk
3f1a75eacc Git: Small simplification to Gerrit "plugin" setup
The indirection is not needed. It's not really stand-alone, and not
touched before GitPlugin::initialize().

Change-Id: If8552dc69ff9efa18a3f1d6d998a8f28ab65e501
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2023-05-08 13:25:48 +00:00
Orgad Shaneh
2c61eac1cb Git: Change default shortcuts for "Current Project" to Repository
Current Project is misleading. Current Repository refers to the
repository of the current file, which is much more expected for
"everything around" actions (Diff, Log).

Task-number: QTCREATORBUG-10170
Change-Id: I252f40cd3dfd9de184a889355b59f91bb64983dd
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-05-08 06:29:59 +00:00
Jarek Kobus
a3a5b8f806 Utils: Rename asynctask.{cpp,h} -> async.{cpp,h}
Follows AsyncTask -> Async rename.

Change-Id: I37f18368ab826c9960a24087b52f6691bb33f225
Reviewed-by: hjk <hjk@qt.io>
2023-05-03 13:24:20 +00:00
Jarek Kobus
7ab0fd56ae RunExtensions: Move onResultReady and onFinished into asynctask.h
Change-Id: I96dbf5b0253251224ae678172cd5fca12b34326a
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-04-17 09:10:33 +00:00
Andre Hartmann
b9af26adf3 Git: Fix soft asserts on failing instant blame
When git blame returns no output, silently avoid creating
annotations instead flooding soft asserts.

This situation can easily happen when navigating to a
header file that is not under version control.

Fixes: QTCREATORBUG-28768
Change-Id: I8d2f443dec98575221995a9016bd2f8442c682cf
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2023-02-19 14:56:14 +00:00
Andre Hartmann
86ffc29239 Git: Avoid passing strings to resolve text encodings
Therefore, merge the code of codecFor() and encoding()
to avoid further mis-usage.

Change-Id: I086e4ace6c791d16f43f14c423b6529ad199c456
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2023-01-30 17:51:47 +00:00
Andre Hartmann
61fab0b736 Git: Fix instant blame text encoding
Fixes: QTCREATORBUG-28728
Change-Id: I875488badc84b664eaa1223b37657dcb417157de
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2023-01-30 12:32:03 +00:00
hjk
2336ff5570 Git: Some more FilePath proliferation
Change-Id: I8d3d97d0c7979d741a7da333f922ce93359afef8
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2023-01-23 07:15:17 +00:00
hjk
013ad1345e VcsBase: Proliferate use of FilePath
... and update user code.

Change-Id: I52c08e9e07238536d31fc72f97312ac582a1e32f
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2023-01-20 12:02:32 +00:00
hjk
17b20e0622 TextEditor: Tr::tr
Change-Id: I28aa68e25c53c3a4d1c370074d7b3318944dc45a
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-01-18 07:02:12 +00:00
David Schulz
baa1e3c2e1 Editor: Allow to hide annotations for a group of text marks
The hiding is not persistent, so on the next Qt Creator start all
annotations are visible again. This is meant to quickly get rid of
annotations if there are to many irrelevant of a specific kind.

Change-Id: I4862e56e0f5624f30aadda26efc9dea672ab1f57
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-01-12 10:19:10 +00:00
Kai Köhne
56baf8c058 Remove GPL-3.0+ from license identifiers
Since we also license under GPL-3.0 WITH Qt-GPL-exception-1.0,
this applies only to a hypothetical newer version of GPL, that doesn't
exist yet. If such a version emerges, we can still decide to relicense...

While at it, replace (deprecated) GPL-3.0 with more explicit GPL-3.0-only

Change was done by running

  find . -type f -exec perl -pi -e "s/LicenseRef-Qt-Commercial OR GPL-3.0\+ OR GPL-3.0 WITH Qt-GPL-exception-1.0/LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0/g" {} \;

Change-Id: I5097e6ce8d10233993ee30d7e25120e2659eb10b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-01-06 11:15:13 +00:00
Jarek Kobus
ce161d0b16 VcsBase & dependent: Fix const correctness
And some minor cleanups.

Change-Id: Id0c2df6865ba84c054f0fb97c0ac42a76a128355
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-12-14 16:57:14 +00:00
Orgad Shaneh
038847709c Git: Suppress all output for instant blame
Change-Id: I5ad295cef22d0448f79d9187df85b582287b2835
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2022-12-14 11:54:05 +00:00
Orgad Shaneh
2119dd4397 Git: Do not show progress bar and the command on instant blame
Change-Id: I22d06d0359d82d086062be4990b51858754b9145
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2022-12-14 11:04:18 +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
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
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
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
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
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
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
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
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
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
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
604730f14d CleanDialog: Use more FilePath
Change-Id: Id545b8c412d55d8e1976cbe0bbdad36e22eb93a0
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-10-02 19:04:58 +00:00
Jarek Kobus
2f093aec66 GitPlugin: Drop unneeded namespace specifiers
We have using namespace in this file.

Change-Id: I6e9f1259c917c446e52c5e407ec2139cc29c7216
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-09-06 15:09:49 +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
Jarek Kobus
60302debd7 Move ShellCommand into VcsBase plugin
Rename it to VcsCommand. Move also ShellCommandPage into
VcsBase plugin.

Change-Id: I335ac47e3090f2be497643ebcda0eaad2987ac81
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>
2022-08-01 14:33:06 +00:00
Jarek Kobus
f794bb0acf GitPlugin: Avoid using sender()
Change-Id: Ie711630dd4b92bdc69990f421f69b578bc0fe9dc
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-07-22 13:30:08 +00:00
hjk
d83eb0494a Use setClipboardAndSelection more broadly
Basically everywhere besides the EmacsKeys plugin.

Change-Id: Iaf2a0a5d791b5b3dd6df2c05c1b862516630d3f8
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-07-15 07:06:25 +00:00
Jarek Kobus
89e7201048 VcsBase: Hide VcsCommand class
Make it an implementation detail.
Introduce VcsBaseClient::createVcsCommand() method instead
for instantiating VcsCommands.

Replace all occuriences of VcsBase::VcsCommand in public API
with Utils::ShellCommand.

Change-Id: Ie438cc3a5e867b3ee8f9e935b56b2f16ea453f8a
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-07-13 16:01:28 +00:00
Jarek Kobus
0490e3426d ShellCommand: Merge VcsCommand::VcsRunFlags into RunFlags
Use ShellCommand class name in signal-slot connections.

Change-Id: Id50ee6887708558a2ba0972ece6c420b0be36f72
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-07-12 14:49:10 +00:00
Jarek Kobus
e793841b4f Remove Core::ShellCommand
Move the implementation into VcsCommand.
Use Utils::ShellCommand inside coreplugin API.

Change-Id: I74a34057b33832a138b05f1dfa6937565027edb4
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-07-11 10:04:08 +00:00
Eike Ziller
f4c60fdf58 Git: Do not run 'git --version' synchronously at startup
We can easily delay this, and if git acts up for some reason, we don't
have to block startup.

Task-number: QTCREATORBUG-27765
Change-Id: I25aa6f8d04d1fd4b9d87f8ccf7ffd591f7bbe519
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2022-06-29 12:39:28 +00:00
Jarek Kobus
8e0ae8ba96 QtcProcess: Limit the inclusion of qtcprocess.h
Move the rest of QtcProcess enums to processenums.h.
Move ExitCodeInterpreter into processenums.h.
Remove superfluous Utils:: prefix.

Change-Id: Iaa596f353d33d6930085a621b114cc15a35caa80
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-03-02 13:30:39 +00:00
Eike Ziller
3c1a87290e Register some more windows
So they get an entry in the Window menu, and window related shortcuts
are registered correctly.

Change-Id: Ie7e882a009f928f1268fdd312e7fb5362f6a837f
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-02-09 09:12:29 +00:00