Commit Graph

366 Commits

Author SHA1 Message Date
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
a1ad64a50b GitClient: Don't call blocking waitForStarted()
Connect to done() signal in order to detect the start
failure and try to start a gitk from different path.
All trials of starting gitk are done sequentially
and non-blocking.

Give process a parent in order to avoid process leak
on shutdown.

Change-Id: I1d74bfeaca23d38643f3d2f262428732314aefe4
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-06-28 17:29:50 +00:00
Christian Stenger
d78da50f46 Git: Export GitClient and GitPlugin for re-use
Change-Id: I3635af18ec9e5e134219dd8d336b5b78a013d8cb
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-05-16 04:21:58 +00:00
Orgad Shaneh
78b08f57a2 Git: Make git show more async
git describe --tags can take very long when there are many tags.

Run all the describe commands in parallel, and let the user work while
they are running.

Change-Id: Iee56a5d51f93e9c799521bb0b06ba08bb45cb237
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2022-05-12 08:04:16 +00:00
hjk
ab98f31a1d Git: FilePathify GitClient::tryLauchingGitK and surroundings
Change-Id: Icdbd0aab546824c9213402169a165290dd86d3c5
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2021-08-17 11:47:34 +00:00
hjk
b72582c050 Git: Use FilePath in findRepositoryForDirectory
Change-Id: Ia711377111d529e14ed864669df83e1b1bb2bfc9
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2021-08-02 14:40:49 +00:00
hjk
ff57cb548d Vcs: Use more FilePath for file paths
Change-Id: I855cde65d034a9647972a7fddf1e8266d7ccfa88
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2021-08-02 14:40:33 +00:00
hjk
ecbd9f4558 VCS: Partially use FilePath in VcsBaseClient
Change-Id: I024b051ab98ece42ec011bd1c92887a946925c1a
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2021-07-30 13:10:59 +00:00
hjk
edcedabed9 Vcs: Use FilePath in IVersionControl API
Adapt first level of users.

Change-Id: Ifcd7bff45631ff3b9e26a9e3176daa6cf0cf2e56
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2021-07-29 13:20:23 +00:00
Jarek Kobus
91f136ef3a Use Utils::FutureSynchronizer instead of QFutureSynchronizer
Change-Id: Iecfa676f58e5ca82be7c9c94233dcc8d3654c2d7
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-05-12 22:08:02 +00:00
hjk
793d673f39 Vcs/Utils: Use Utils::Environment for ShellCommand
Change-Id: Ica289ab2f83d52270923c4ff4983860cfbe0b494
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-05-05 12:21:29 +00:00
hjk
aa69415ac7 Git: Aspectify settings
Change-Id: I87dfeba360967cc77cc230811bcd9f67b3ea6e38
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2021-03-19 13:39:33 +00:00
Orgad Shaneh
48c56416f5 Git: Do not prompt to add files in a submodule
Fixes: QTCREATORBUG-23845
Change-Id: Ibf20eed26469b5a8599927e5ac2d458bbff9a156
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2020-10-04 17:06:23 +00:00
Orgad Shaneh
eb6a2f2b89 Git: Enable Show for file in a specified revision
Fixes: QTCREATORBUG-24689
Change-Id: Ic4ceb1c59f39009c28be7f34ee62f65fd41506c1
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2020-09-29 07:09:18 +00:00
Eike Ziller
3944162039 Merge remote-tracking branch 'origin/4.13' into master
Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri
	src/plugins/cmakeprojectmanager/cmakebuildstep.cpp
	src/plugins/cmakeprojectmanager/cmakebuildstep.h
	tests/auto/debugger/tst_namedemangler.cpp
	tests/auto/qml/codemodel/check/tst_check.cpp

Change-Id: Iefd5f71c03c0078513b76a92af764a4fb22ee4c2
2020-08-10 15:56:54 +02:00
Orgad Shaneh
14e3a379c1 Git: Suggest branch name based on the commit subject
... when the checked out commit is not a remote branch.

Fixes: QTCREATORBUG-24006
Change-Id: I175a3aedba88bd9e3b5cf298c5c161c56e9d0acd
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2020-08-04 20:23:45 +00:00
Orgad Shaneh
a48cde86f3 Git: Show full description on tooltip in commit chooser dialogs
Like Push to Gerrit, Rebase, Reset, Fixup Commit.

Fixes: QTCREATORBUG-24366
Change-Id: I0f596f84661a1a4f37fe971683cc0d985a6c9b1f
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2020-08-02 05:00:50 +00:00
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
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
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
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
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
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
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
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
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
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
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
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
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
Tim Jenssen
1df6443d4a Merge remote-tracking branch 'origin/4.10'
Conflicts:
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri
	src/libs/utils/synchronousprocess.cpp
	src/plugins/baremetal/iarewtoolchain.cpp
	src/plugins/cmakeprojectmanager/cmakeproject.cpp
	tests/unit/unittest/CMakeLists.txt

Change-Id: I124ad492df403286751e175d27fe36487ddf6d07
2019-07-04 15:17:55 +02:00
Andre Hartmann
b950936d45 Git: Correctly handle aborting pull commands
For example, aborting a "git pull --rebase" command
did not work, because the old code tried to run
"git pull --abort" instead of "git rebase --abort".

As side effect, this patch also enables the Skip commit
button in handleMergeConflicts(), that was not shown
before.

Change-Id: Ifa43a4ba0199c97fdf8a361eb9e0207704d93e26
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2019-07-02 11:04:54 +00:00
Orgad Shaneh
a1ba347fa5 Git: Fix popping of branch-stash after checkout
Checking out a branch that has a saved stash, when
Pop branch stash is checked, is broken since checkout
became asynchronous.

We must wait for checkout to complete before popping
the branch stash.

Change-Id: Ia4d43649e742ced0121ffe106986b4d6ed1e7b38
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2019-07-01 19:57:02 +00:00
Tasuku Suzuki
578cdf7c5a Git: Archive support
This allows users to create archive files from local repository.

Tools > Git > Local Repository > Archive will create <reponame>-
HEAD.tar.gz

Tools > Git > Actions on Commits... you can choose a commit to archive

Change-Id: I09bbbdefe532237e9065d1ca3c21910a036ea149
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Tasuku Suzuki <tasuku.suzuki@qbc.io>
2019-06-10 18:19:57 +00:00
hjk
473a741c9f Utils: Rename FileName to FilePath
More in line with QFileInfo terminonlogy which appears to be
best-of-breed within Qt.

Change-Id: I1d051ff1c8363ebd4ee56376451df45216c4c9ab
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-05-28 12:23:26 +00:00
Andre Hartmann
e65131ac11 Git: add svn dcommit
It's the counterpart to git push when working with
SVN remotes and git-svn.

Change-Id: I02257ea921fdcdedec294b28e8756ed88fb764b3
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2018-11-25 14:19:30 +00:00
Orgad Shaneh
92431932e3 Git: Show detached HEAD in branches view when applicable
Fixes: QTCREATORBUG-21311
Change-Id: Ia4297d23a965d83ea2814bd1e41f35a3017b8e9b
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-11-12 09:48:25 +00:00
Alessandro Portale
3b6f45a7a3 Git: Modernize
modernize-use-using
modernize-use-default-member-init
modernize-use-equals-default

Change-Id: Iaccd5611cfc2056d357a0545f8522f02d6f8f0ed
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2018-11-10 21:03:01 +00:00
Orgad Shaneh
fe87339888 Git: Fix resolving top level for non-existent sub-sub-directory
When a directory is renamed, and it has sub{sub-}*directories, executing
git blame on a file in the subdirectory -> Blame Revision (or parent) for
the file in the previous name -> Show failed because it couldn't determine
the top level directory.

You can test by opening qmakeprojectmanager/wizards/filespage.cpp and
blaming one of the lines that had it as qt4projectmanager/...

Change-Id: I7ac964c12f1f368c5ce92e9bedd972a2bc824935
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-10-25 17:52:28 +00:00
Orgad Shaneh
762fb5c353 Git: Make checkout asynchronous
It can be slow when many files are replaced.

Change-Id: I308698ef36973374f4526107fbda0d9ad907e707
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-10-10 08:30:16 +00:00
Orgad Shaneh
754fd66a0b Git: Suppress error messages for newly initialized repository
Change-Id: Ib7161e165fdf9cc2b1167b683e8e3dac17e0f1d6
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2018-09-29 16:51:45 +00:00
Orgad Shaneh
296ae92853 Git: Change pull to run asynchronously
Fixes: QTCREATORBUG-13279
Change-Id: Idee6e64e5eebe729e7c1d0e0135a1d8b464187b7
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2018-09-19 17:02:24 +00:00
Jarek Kobus
da2c66b1d0 Move git specific stuff out of diff editor plugin
Move it to the git plugin.

Change-Id: I8151573ed50df70776f7ebf0475dd41fb84fae83
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-03-15 11:21:01 +00:00