Commit Graph

577 Commits

Author SHA1 Message Date
Marcus Tillmanns
291a893f5f VCS: Allow remote vcs operations
Both VcsBaseClient::vcsBinary() and VcsBaseClient::processEnvironment()
get an additional parameter "FilePath target" to allow selecting binaries
and environment based on where the repository is located.

This allows to select e.g. a git binary on a remote device, and the
environment of the remote device for each VCS operation.

A bunch of file path operations are either fixed or ported to actually use
FilePath correctly.

Change-Id: I6afc645772fde3dff3ec19c13efe538e5888e952
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2024-02-12 11:25:06 +00:00
hjk
0b44cc5589 Vcs: Hide topic cache in new IVersionControl pimpl
Potentially more stable api long-term. Also simplifies the
user side code a bit.

Change-Id: I6913e27e2a5dc14907e72f252081cdbed34842a3
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2024-02-09 16:00:56 +00:00
hjk
4e5692d628 Vcs: Use QString and Id in editor parameters instead of char *
... and use it to simplify the translation setup.

Change-Id: Ibd386ede3ecfc351316bed53bc184954adbcaa74
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2024-02-09 10:27:01 +00:00
Marcus Tillmanns
70e013fd25 Git: Cleanup gitExecutable()
Using expected removes a bunch of handling code.

Change-Id: Id524912d82aa693fbb39c7e7fa34abd77153f92e
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2024-02-08 13:24:38 +00:00
hjk
2d37a7421f VCS: Simplify VcsEditor setup
Create the editor parameter structures in-place, and also
include the other two parameters in the struct to simplify
the signature of the c'tor.

Change-Id: Iff7d5ddf3096f4a3ed18e53265ae74806823af32
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2024-02-07 14:49:02 +00:00
hjk
ad2230b1e1 Vcs: Move VcsEditorFactory closer to its product
Change-Id: Iaf2e6bdb4f04f0f1314ca7725feb63394a693511
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2024-02-07 09:58:23 +00:00
hjk
a39d38d187 Vcs: Merge basevcssubmiteditorfactory.* into vcsbasesubmiteditor.*
Not worth a separate translation unit anymore.

Change-Id: I579c81c811cd84d89fd39755dca2fbeffae017de
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2024-02-07 08:03:26 +00:00
hjk
980605ecb0 Vcs: Make submit editor setup a bit more compact
Change-Id: I14c4c51a456f7b3b04b79b63b476f89eb58d3ea0
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2024-02-07 07:53:48 +00:00
hjk
48d47faa4b Vcs: Rename VcsBasePluginPrivate to VersionControlBase
The classes derived from this had a dual role of implementing the
version control interface (IVersionControl) and as the plugin pimpls.
The name was focusing on the latter, but plugin pimpls are being phased
out in the new 'setupFoo()' world, so only the version control interface
part remains.

Change-Id: I60396f1729c736bc6c9e4fca250a5926e9d60f51
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2024-02-06 16:34:44 +00:00
Jarek Kobus
8bcc78a044 Various plugins: Fix some more C++20 warnings about [=] captures
Change-Id: If20aac4320c84096a07d67cc137886638286acf8
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2024-02-06 08:34:44 +00:00
hjk
ce1e565a10 Utils: Also rename parameteraction.{h,cpp} to action.{h,cpp}
Change-Id: I203909d9b2d460012b9347d507ac7a701700c48a
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2024-01-29 14:23:39 +00:00
hjk
66b50438d8 Utils: Rename ParameterAction into Action
It became the defacto-type for action when ActionBuilder started
creating them as default.

Change-Id: I1008d60b78ea83919ce1c80a7ef828527fe9902c
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2024-01-29 13:01:29 +00:00
Jarek Kobus
98c0e9764a Git: Use QVersionNumber for git version
Parse the version string with base 10 now.

Amends abee98b44817d1aee63b5cd9b673d0c3aa1733ba

Change-Id: I2f0b47380a9714b3f3de475ddabe78875db3b608
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2024-01-20 16:30:51 +00:00
hjk
bd0ef97580 Git: Hide plugin class definition in .cpp
... and move tests into a separate class.

Change-Id: Ic9e4ad063b132cf51b1433b93bf61262540ba005
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2024-01-15 11:48:30 +00:00
hjk
892e7c0f3a Git: Separate internal plugin access API from plugin class
Plan is to hide the plugin class definition to the .cpp later.

Change-Id: I27f6d2dd23adb4f3ab47d99b0626956889d2750f
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2024-01-15 10:08:10 +00:00
Andre Hartmann
ff9170b820 Git: Move Instant Blame into own class
Change-Id: Ic7bdfb47d0de2a5499e40c9eeaead8bbf30a12e5
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2023-12-10 20:21:39 +00:00
Andre Hartmann
c0d7835022 Git: Stop Instant Blame when git returns empty blame data
That can happen for example, when having a file with active
Instant Blame open and choosing "Save As" to save a copy
of that file in a folder not under version control.

Also fix the related case, when the file is saved in the
same folder, but is not under version control yet.
In this case, let's remove the blame mark, otherwise it
will stay forever as we only stopped the cursor connection.

Fixes: QTCREATORBUG-29991
Change-Id: I6ffed869c18334ba87dbcded409d31ead21f4b25
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-12-04 13:07:45 +00:00
Eike Ziller
ad7d559028 Tr: More small fixes
Change-Id: I5d9324d3f64eaa522fa1d435efa39fa43d84798a
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2023-10-18 12:10:45 +00:00
Cristian Adam
d3dcb894e8 Git: Use a hyperlink for the git sha1
This way it's clear how you should get to the commit.

Change-Id: I6131ffab1855d686828137fb608d3edc57846cf5
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-09-19 17:52:13 +00:00
Eike Ziller
dab19c4a8c Use Nanotrace to generate startup performance report
Add various trace points to the code, including the plugin
initialization methods (centrally in plugin manager), code that is
scheduled on the event loop with QTimer::singleShot or
QMetaObject::invokeMethod during initialization, and code that is
triggered from ICore::coreOpened

Can be turned on by configuring with `BUILD_LIBRARY_NANOTRACE=ON`
Run with `-trace <file>` to write trace file. If Nanotrace is not built,
the added code expands to nothing.

Changes in Nanotrace:
- turned generated data to microseconds instead of nanoseconds, because
  that is what Chrome tracing expects
- fixed serialization of duration (needs to be an item of the event, not
  in a "arg" subitem)
- fixed shutdown() to reset the initEvent

Change-Id: I994de82023b820d771e1be0a859ebd8da0b73d4d
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-09-12 07:32:07 +00:00
Orgad Shaneh
4ad3925da4 Merge remote-tracking branch 'origin/11.0'
Change-Id: I5cdff1f5db3fae89beef3d27316b21440541bb1c
2023-07-30 16:24:15 +03:00
Andre Hartmann
e49ac10cb1 Git: Ignore irrelevant changes in instant blame
Optionally ignore whitespace changes or line
moves to only show the last real code changes.

Feature is disabled by default.

Fixes: QTCREATORBUG-29378
Change-Id: Ia2d5ad926f4098554b1ed3365bffadd4e2063e8e
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2023-07-28 11:10:40 +00:00
hjk
778a1d75ba Git: Initialize GitClient on first access
This does not change the current timing of construction a lot as
the GerritPlugin may need it immediately in some cases, in any
case the gitGrep instance will need it.

There's nothing big going on at destruction time, so the prolonged
lifetime until really close to the end does not hurt.

The reason here is that this way we will avoid cases like in change
5e5b90a9a1.

Change-Id: I326d83c1a3d21114322ac6cce8d9e9b782faacdc
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2023-07-26 10:25:43 +00:00
hjk
5e5b90a9a1 Git: Switch order of GitClient and GerritPlugin construction
The GerritPlugin constructor calls GerritParameters::fromSettings()
which then calls calls detectApp() if there is no curl (or no ssh/GIT_SSH).
On Windows this ends up calling GitClient::instance()->gitBinDirectory()
which crashes as the GitClent instance does not exist at this time.

Work around by switching the construction order.

Change-Id: I0b1172d6b7ec96502a51684578b78042a42a95ca
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2023-07-25 15:43:13 +00:00
Jarek Kobus
481d301c5c GitPlugin: Replace QVector with QList
Change-Id: I20218a5fcd9b4af6e6633de55d41d4ba771bcd75
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2023-07-18 20:48:28 +00:00
hjk
9a69c78ca5 Vcs: Convert settings pages to latest style
Last change in that area for this year.

Change-Id: Ibae9f1869cb20faf85c0c1669b84751ad022b8fd
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2023-07-18 12:15:07 +00:00
Andre Hartmann
af5a8fe80c Git: Restart instant blame on document save
When the current line is modified, refresh the
blame after saving. Before, the cursor had to
be moved to another line to restart the blame.

Change-Id: I61012f1c8583545b9bc34a71ff63ade2f9cc5b13
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2023-07-17 11:38:37 +00:00
hjk
93d96c9d75 Vcs: Code cosmetics
Drop some Utils:: and rely on some aspects' operator()()

Change-Id: I40d2c2973c1c9eff443bb74b8da44e0824d8d5c6
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-07-14 09:53:50 +00:00
hjk
379e7f906e Utils: Rework aspect implementation
This avoids some repetition and could be a step towards
having type storage in (or rather accessible from) the base,
so we can have aspects for more complex data (treemodels...)
that are not easily converted to QVariant.

Change-Id: I9797b3d5646195705212db1830d2b415291ac651
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-06-29 11:25:44 +00:00
Andre Hartmann
419f5416c5 Git: Avoid main loop blocking in instant blame
Query the author and encoding information asynchronous
after the current repository is changed.

Set the default codec to UTF-8, which should cover most
configurations (i.e. almost never be different).

In case requesting the information takes longer, the blame
mark is already created with the cached information.

In case the author or encoding changed, the blame mark
has to be recreated.

The call to refreshWorkingDirectory() is moved after the
widget checks in setupInstantBlame() to avoid requesting
these information in VCS editors.

Fixes: QTCREATORBUG-29151
Change-Id: I6feccbbed67c877f1015295f630dd63cf3ccf4a0
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2023-05-29 06:06:54 +00:00
hjk
6f31d87444 Use more FilePathAspect
Change-Id: Ib348df1460f8610607251498b07010df58d51ddf
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-05-19 15:07:17 +00:00
Andre Hartmann
29371dc2f3 Git: Cache author and encoding for instant blame
Querying both may be expensive and is only
necessary when the repository is changed.

Fixes: QTCREATORBUG-29151
Change-Id: I1d37f8b8708c02a8c3dc2d89fe7e331f0f416818
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2023-05-17 07:06:05 +00:00
Andre Hartmann
ac0f273081 Git: Fix missing instant blame with line folding
When lines are folded (e.g. the license header),
the editors lineCount() is smaller than its
blockCount(). That resulted in missing blame marks
for the last document lines. E.g. if 10 lines were
folded, the last 10 lines did not have blame marks.

Change-Id: I502afb09697fd3d6a062d3ae2321357a3e565a0e
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-05-17 07:05:33 +00:00
hjk
ce7ee677d8 Vcs: Use PagedSettings for all plugin settings
Hopefully the last structural change for a while.

Settings lifetime is again tied to the plugin private.

Change-Id: I221e8b8baa69422306191b48a9f034ef5b1a0dc2
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2023-05-15 13:11:05 +00:00
hjk
545a105634 Git: Also use the latest settings setup approach
Change-Id: I34a210575d02d18927c1e0f6d8ea6cb9924c563d
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2023-05-15 13:09:47 +00:00
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