Removing a file from TortoiseHG data source - file

I am using TortoiseHG for source code control in Windows, I forgot to edit the ".hgignor" file, and now I have a huge folder ".hg" which I know it's because of DLL and EXE and PDB files which I do not need them. Now changing the ignor file does not remove those files.
What should I do for deleting these files completely from my TortoiseHg data source?

if you want to stop tracking files, but leave them in working directory, use hg forget. Help also says you can achieve the same effect by using hg remove -Af.
I'm not sure what do you mean by «data source», but neither of those will remove the files from repository itself, because they are already a part of your history, and thus their previous versions will remain there. Forgetting them will only prevent your history from bloating even further with newer versions of those build artifacts.

You can use the hg remove command to remove files in your repository. If you are using TortoiseHG, you can right click on the file and go: TortoiseHG -> Remove File.
Check out the "How to stop tracking a file" section Here.

Related

Changing Directory of STM32CubeIDE Projects

When I create a new STM32CubeIDE project, it default saves it to my /Documents directory. This isn't too bad except I like to have a folder for each application so that it isn't just a bunch of files. I tried creating a folder called "STM32CubeIDE" to save new projects to, put it gives me an error: "overlaps the location of another project".
I've done some googling and found that this issue also exists in Eclipse (which makes sense) but couldn't solve my problem from those solutions.
I was also wondering if there is a way to move all of my existing projects to this newly created folder? Last time I tried, the IDE flipped out on me and couldn't find my stuff.
First of all, do not call your folder "STM32CubeIDE" if this already exists. Use a different name, because this is normally used by default and it may cause issues (probably the reason why you are getting that error).
When you install or update STM32CubeIDE it gives you the option to choose where you want your default folder to be. For example, my default folder is
C:\Users\%USERPROFILE%\STM32CubeIDE\workspace_1.6.0\
Now if you want to use different folders for different projects, there are two options:
You can Export your project (application) to a desired folder and then Import it using the File tab. This is a good method if you want to make backups, or just want to make sure that all relevant files are transferred correctly to avoid "missing file" issues.
The other method (my favourite) is to simply copy you project folders and paste them to a different folder, wherever you want to put them. Then you simply open STM32CubeIDE, go to File > Open Projects from File System... and chose your project. You might get a pop-up about software compatibility issues (if you made an update), etc. but this should open up your project and show it in the Project Explorer.

KDevelop: Hide backup files

I am using KDevelop 4.3.1 with Debian Wheezy.
My problem is, that for every file in my project directory KDevelop seems to create a backup file with the same name, ending with a tilde. This makes the project directorys look really unclear.
My question is if there is an option to hide these backup files (e.g. all files ending with a ~) in KDevelop? Meaning in the sidebar list of project files.
The backup files are created on save by the text editor component "Kate Part". To get rid of the *~ files, you have two options.
First, open the editor settings dialog through Settings > Configure Editor and then choose the Open/Save item, and then the Advanced tab.
Disable backups
To disable backups entirely, remove the checkbox for [ ] Local files.
Hide the backup files
To hide backups, just add the Prefix: ., so that every backup file is a hidden file. A backup file is then named e.g. .MyFile.cpp~.
The idea behind the backup files is to have the old version around in case the saved file is corrupted for whatever reason (system crash, file system error, ...?). In practice, you most probably do not need backups at all for the following reason:
When saving files, Kate uses the class KSaveFile (in Qt5 available as QSaveFile). In short, to avoid data loss, KSaveFile saves the file to a temporary file in the same directory as the target file, and on successful write finally moves the temporary file to the target filename.
In other words, saving files is pretty save and in theory should always work due to the atomic rename thanks to KSaveFile.
So the only use case for backup files are that you changed and saved a file by accident. In this case, the backup file still contains the old data provided you did not save twice.
Even more so: If you use a version control system (git, svn, ...), the usefulness of having backups is close to zero. That's also the reason why backups are disabled entirely in newer versions of the editor component.
If you use this filter (in the top of the file list):
[A-Z]*[A-Z]
You may only see files starting and ending with a letter so no hidden files (starting with a '.') and no backup files (ending with a '~') will be shown.
Be careful as any other file not starting or ending with a letter will also be hidden

Updating previous installation settings

I'm creating an update setup files. In my initial installation, I have an EXE file which is called in [UninstallRun]. In the update, I want to permanently remove this EXE file but it seems to always throw the error "Some elements could not be removed" when I uninstall after the update.
To delete the EXE, I've tried deleting it during the update's [InstallDelete]. This deletes the file, but the error message is still thrown when its uninstalled (even though all files have definitely been removed).
I tried replacing the EXE in the update and using the deleteafterinstall flag, but that didn't make a difference.
If I don't do anything, and just install it, when I run the uninstaller, the EXE file is called, even though the update no longer contains the [UninstallRun] section. So it looks like the initial installation's setup file is being used for the uninstallation part.
For the purposes of this project, I can't change the initial installation, so everything has to be done from the update installation. Is there a way to delete an existing file that was placed in an UninstallRun section?
The issue is that the [UninstallRun] entry from the prior install has already been registered in the uninstall log, so simply removing it from your script won't stop it taking effect, and deleting the file will by default make it generate that error since (presumably) some required uninstall task didn't happen since the file was missing.
Did you remember to put a RunOnceId on the [UninstallRun] entry in the original installer? If so, you can put a "replacement" entry using the same id. You'll still have to make it point at an exe, but you can make it a no-op one, or (better) use Flags: skipifdoesntexist and point it at the one you've removed.
If you didn't use a RunOnceId, then there isn't any way to override the previous entry. You'll just have to put in a dummy exe file that does nothing.

Removing unused .m files

I have a Matlab GUI file, that uses several other .m files (all of them in the same directory as the GUI file) for working. I would like to remove any other file in the current directory that isn´t used by the GUI file. How could I do it easily and without any risk of removing any file needed?
You can check the dependency analysis offered in the editors tools menu.
This gives you an option to run the report on the Current Folder, which you can inspect to spot unused .m files. Other than this, I'm not aware of an automated way of doing this.
There is an automated way - run the function depfun, it will give you the list of the dependencies.

Copying a KDevelop project to another directory

What is the best way to copy an existing KDevelop project folder to another directory, so that the new project contains all the correct directory settings and configuration and there is as little manual editing (and thus less room for error) as possible?
There is some information about someone being successful here about copying the project and then editing every reference to the old path, but this is exactly what I'm hoping to avoid.
In fact, the Kdevelop manual specifically recommends against doing this (see manual, chapter 8, "Project Hacking" [would post a link but I'm nerfed for now]).
This project is shared on an SCM and should have as little dependency on a particular user as possible.
Project-files are project-related and therefore contain a lot of absolute paths etc. Its mostly easier to just import the sources again as a new project.
I'm using CMake which means that I just need to reset build-paths and the install-prefix. Sometimes environment variables needs to be added but thats just copy+paste.
I just had the same problem. An answer to a related question brought me to the following approach:
One can keep (and put under version control) the file <project name>.kdev4 in the top directory of the project. (At least in my case, it doesn't contain any absolute paths.)
The hidden directory .kdev4/ in the top directory of the project should be deleted after copying (and excluded from version control) while kdevelop has not loaded the project.
The project can now easily be reopened by kdevelop using Project -> Open / Import. After pointing kdevelop to the top directory of the project, the file <project name>.kdev4 is recognized and can be accepted. kdevelop then asks for the missing options.
This solution should be clean and cause minimal overhead when continuing work on a project in another directory. In my case, when reopening a cmake project, I could simply accept the proposed defaults. The hidden directory .kdev4/ is recreated when closing kdevelop.

Resources