Commit Graph

816 Commits

Author SHA1 Message Date
Orgad Shaneh
c0c5773345 Git: Add new files with --intent-to-add
Sometimes the file is modified after adding it, either by Qt Creator itself
or by the user.

Running Diff on such a file may look strange. Instead of showing the entire
file, it shows the diff since it was added with its initial content.

Fixes: QTCREATORBUG-23441
Change-Id: I712cc574053f39753250685aec148d2b6d7db192
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2020-07-19 03:59:45 +00:00
hjk
e1c88116b3 Core/Utils: Migrate further to Utils::Id
The coreplugin/id.h header is kept for downstream for now.

Change-Id: I8c44590f7b988b3770ecdc177c40783e12353e66
(cherry picked from commit 430a33dcd9)
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-07-06 11:15:18 +00:00
Andre Hartmann
c9eedbe0f3 Git: Port colorful log to text colors
Fixes: QTCREATORBUG-24198
Change-Id: Icde06da5ac848fb0f7faf02a8e55fb26136f318c
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2020-07-06 10:55:43 +00:00
hjk
1c81a3b3e8 All: Use Utils::SkipEmptyParts
Task-number: QTCREATORBUG-24098
Change-Id: Iab45de9a9c17ddc39a0e343b1175d4f6cb94b098
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-06-17 05:55:25 +00:00
Orgad Shaneh
bfcd1149eb Git: Do not read working directory before it is set
This amends commit c17767c78e.

Change-Id: Ide6f9de2420dd1262b27aed83351b76404cdba30
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: hjk <hjk@qt.io>
2020-06-08 13:18:28 +00:00
Andre Hartmann
79766caf52 Git: Use internal log highlighter for old git versions
Git didn't have RGB color support before version 2.3.0.
If an older version is used, fall back to the internal
log highlighter, i.e. don't disable it.

Amends commit d1b096699

Change-Id: I66f84dc4e79f7374d02f6d76c6f912c43e7f04bd
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2020-05-19 12:00:52 +00:00
Andre Hartmann
d1b0966996 Git: Fix filling commit selection combobox for log
Broken by commit cbb70513bf, which changed the
format for the normal log to override the highlighter.

We still need the hightlighter for the log with diff.

Therefore, a separation between highlighting
and parsing the log is needed to populate the
combobox for commit selection again.

Change-Id: I902ce548fc25875f2cd67b165283ff1236329afa
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2020-05-16 19:47:46 +00:00
Andre Hartmann
cbb70513bf Git: Allow colorful logs
Requires Git 2.3 or higher for RGB colors.

Can be enabled for the normal or graph log
with the "Color" tool button. For the diff
log, the old behavior is kept (highlighter
is used for the "normal" log, no colors at
all for the graph log)

Fixes: QTCREATORBUG-19624
Change-Id: I8a42a7ad0ebf99ceb459355310311d702dcf9977
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2020-05-13 14:03:46 +00:00
Andre Hartmann
f486ff7dab Git: Add git bash to tools menu
Can be useful to perform tasks that don't have
a dedicated UI in Creator.

In my setup, git bash was directly in the git
installation folder %ProgramFiles%\Git and
therefore one level above git.exe itself.

Change-Id: I1ca0d3439690170d7fb840bca17e2c412effe0a4
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2020-05-05 14:23:03 +00:00
Orgad Shaneh
4e66cd0770 Git: Support diff against a selected commit
Change-Id: Ibb4287bf00f1d0c3212630d60e59ab80b600a879
Reviewed-by: hjk <hjk@qt.io>
2020-04-21 10:06:44 +00:00
Orgad Shaneh
0b57675d40 Git: Simplify diff editor controllers
Change-Id: I3c1fb205a1197d6c3a457067eb2b7f355f28c55c
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2020-04-14 05:25:08 +00:00
Orgad Shaneh
9e3bbf36f2 Git: Change some functions in GitClient to const
Change-Id: Iefd3e0345c7a507d1d5c225ea81677e7a93df295
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2020-04-10 14:18:56 +00:00
Orgad Shaneh
c86c4d54e2 Git: Fix order of arguments on branch diff
When there is a command in progress.

Change-Id: I73e8378283fcc34f324f862daaf2529b6a0f1265
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2020-04-10 06:01:31 +00:00
Andre Hartmann
a59420a9c3 Git: Improve the Checkout > Create Branch > Add dialog
Suggest a local branch name here also.

Fixes: QTCREATORBUG-23797
Change-Id: I16228507858380bc2ff6dc8590279155624d3d28
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2020-04-04 19:26:52 +00:00
Leena Miettinen
ff8751c576 Git: Fix UI text according to the guidelines
https://doc.qt.io/qtcreator-extending/qtcreator-ui-text.html

Task-number: QTCREATORBUG-23683
Change-Id: I1843de5a9166760bf52632f75dab74507029bf8c
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2020-03-11 10:23:37 +00:00
Orgad Shaneh
ba87fb2083 Git: Add actions for changes in output window context menu
Change-Id: I5aa46f87b82670286ac225d71a3a045133976e86
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2020-02-28 09:53:51 +00:00
Orgad Shaneh
b52ffa2501 Git: Move addChangeActions from GitEditor to GitClient
Change-Id: Id901994ac2909b00ca58a0a8a91d2d3a273c39b3
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: hjk <hjk@qt.io>
2020-02-26 10:40:21 +00:00
Orgad Shaneh
7c4f0a9b1e Git: Store singleton instance in GitClient
On many cases, GitPlugin is not required at all, and is only used as
a proxy for GitClient.

Change-Id: I246012658ab3e8c7a12f1a459b1b1748ff358e0b
Reviewed-by: hjk <hjk@qt.io>
2020-02-26 10:29:27 +00:00
Orgad Shaneh
b14351dab8 Git: Support case-insensitive grep/pickaxe
Change-Id: Ie3da0f5cca2bd3ffa658e3adbba0b1b86a2911d9
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2020-02-20 19:05:36 +00:00
Orgad Shaneh
6d8efefbe5 Git: Add a toggle button for filter widget
Change-Id: If9680d1fc8a06f57f995a63095ad201fc1f3156b
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2020-02-20 19:05:25 +00:00
Orgad Shaneh
ee05e49f79 Git: Support entry list in reflog
Change-Id: Ic24eff465c6870f42c1964a8700cc6f0b2c0dce5
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2020-02-19 07:23:42 +00:00
Orgad Shaneh
857102748d Git: Refine editor names
Change-Id: I8302e1341e589b3c0e39c3d6c1d73b01e142e517
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2020-02-19 07:23:26 +00:00
Orgad Shaneh
c728d04b52 Git: Support reflog also for branches
Change-Id: I9321ba4964d086d90aaf540a2006f95b94de8375
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2020-02-19 07:23:11 +00:00
Orgad Shaneh
c9f1d84db7 Git: Add config widget to reflog
Change-Id: I04a9bd86c38ab27537c2d6981179a667bc36e61b
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2020-02-19 07:22:57 +00:00
Orgad Shaneh
1b2aa56f15 Git: Add grep and pickaxe filters
Fixes: QTCREATORBUG-22512
Change-Id: I98eed9a7f9da15e163804a0fd81713149a06c5b0
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2020-02-17 13:11:52 +00:00
hjk
b9739c0945 Git: Hack around quoting problem with Short description on blame
Task-number: QTCREATORBUG-23208
Change-Id: Iaff99d7cd175d3d974ea295472cba2679da08372
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2020-02-17 07:01:13 +00:00
Andre Hartmann
b3cf553e1a Git: Ignore unknown push failures
Pushing to Gerrit can fail with due to missing
Change-Id. In that case, none of the existing
warnings should appear.

Change-Id: I4bf55d35a792b680e3ae524e116ce5db9fdd405a
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Miklós Márton <martonmiklosqdev@gmail.com>
2020-02-16 16:18:35 +00:00
Orgad Shaneh
f2cd459ec5 VCS: Abstract multi-choice settings in editor config
Change-Id: Iafc089f5ad3796348ab9521b71b31cb645238292
Reviewed-by: hjk <hjk@qt.io>
2020-02-13 07:58:14 +00:00
hjk
eb1226df68 Git: Partially move plugin pimpl to .cpp
Same procedure as for ClearCase.
Unfortuately, some deep accesses are not easy to get rid of. Make them
available by static functions in the plugin itself. Definitely not the
favorite setup, but allows to proceed with the QObject removals.

Change-Id: Id85ed07bc7a6c1c053431a14dd7f68892f7ebea0
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2020-02-07 12:56:10 +00:00
hjk
b22768e980 Diff/Vcs: Use a function object for reloading
Helps with slimming down the user code side.

Change-Id: I4b0aac76c0d1516eb05bff9c18594e64f8b41a7a
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2020-02-06 11:21:59 +00:00
hjk
c17767c78e Vcs: Use setters to set up DiffController parameters
Plan is to avoid client use down there, so extract the actually
used data first and pass it down.

Change-Id: I088fc9cc3086e8f6e1e0c3c9d3a35445f752e6f0
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2020-02-06 07:03:14 +00:00
Orgad Shaneh
adcea96868 Git: Rename Show Diff -> Diff
Change-Id: I5b04edb6661cde53003a8cfe72854b4c214e187e
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2020-02-05 21:15:23 +00:00
hjk
b8fe25db25 Vcs: Merge IVersionControl and VcsBasePlugin hierarchies
They were 1:1 in parallel, with quite a bit of function call
ping-pong inbetween, for code-sharing-by-inheritance. Merge
them by making VcsBasePlugin inherit IVersionControl and
merge the derived classes below.

Size of this patch is hard to avoid as all seven systems have to
move simultaneously. Non-necessary potential follow-up cleanup
have been left out on purpose.

Change-Id: Icb71e4182af3db21069cc637e7ae87ffa3829791
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2020-01-31 12:36:23 +00:00
hjk
866f3aeb4a Vcs: Pass settings handles to settings pages more directly
Change-Id: I5fdec80de5678dd544713fc18335cbd805d7b9f4
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2020-01-24 11:40:49 +00:00
hjk
1cd936c531 Vcs: Pimpl plugins
Essentially rename all *Plugin into *PluginPrivate, and pull out
the actual IPlugin related pieces into new *Plugin classes.

Shift the construction of the PluginPrivate to initialize(),
following the general pattern.

I tried to keep the patch as mechanical as possible, giving
room to some obvious but less mechanical cleanup needs,
that are intentionally left out of this here.

Change-Id: Iac662bf73338f9f7669064ed67b960246875c23c
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2020-01-24 09:47:28 +00:00
hjk
823c44de18 Vcs: Move static functions out of VcsPlugin "namespace"
Plan is to split VcsPlugin in the pure IPlugin and a new class
the remaining non-IPlugin bits of VcsPlugin, call it VcsPluginPrivate
and use that d-ptr for VcsPlugin. VcsPlugin-derived classes can
then use VcsPluginPrivate derived private, later pointer members
of the *Privates can be made proper members, moving towards the
otherwise predominant plugin setup pattern.

Change-Id: I62db9269e8ca50633c24b6d1d735d59c8fa8e5a5
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2020-01-23 08:20:36 +00:00
Andre Hartmann
cb8da0e93b Git: Fix updating branch view on push to new remote branch
If the remote branch does not exist yet,
we need to update the whole branch model,
in order to set the remote-tracking information
and to add the new branch to the remote branches.

Amends da6972e0a9

Change-Id: I9f01ceffa45fcb5e2ea8afe8762b102a550b8e43
Reviewed-by: Marius Sincovici <smaryus@gmail.com>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2019-12-29 06:24:20 +00:00
Andre Hartmann
da6972e0a9 Git: Update current branch after some operations
... to refresh the branch view upstream status.

No need for a full model update here, only the current
branch is influenced.

Change-Id: I6bd17a841988b36221e5015a5858071d33a7b5e5
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2019-12-27 11:51:45 +00:00
Andre Hartmann
acd1d6c438 Git: Always use commit hash in archive
Storing the archive as "Project-HEAD" or even
"Project-master" is ambiguous.

Better resolve the reference to to have unique
archive identifiers.

Change-Id: I1233c20e5975028d084d6587b4a0f47390d1fd17
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2019-12-24 08:50:42 +00:00
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