SVN Getting The Count Of Revisions Of A Repository - qt

I am curently working on a Qt c++ project that is basically printing all the commit log messages between a specific SVN Repository's 2 specific revision's (User enters the repo and the revisions).
I need to get the count of revisions in a repo URL.
I want to do this on Windows 10 so I guess a batch command could be pretty useful.
I am using Visual SVN Server and Tortoise SVN.
(My Qt version is 5.11.1 if it would be necessary)
I have a batch script that does print all the logs between 2 specific revisions to a .txt file.
It is like this:
#ECHO OFF
REM This Script Takes all the logs between a given repository's 2 specific revision.
REM Below, we store the first parameter which is the URL of the Repository that is wanted.
SET urlOfRepository=%1
REM Below, we store the second parameter which is the first revision that is wanted.
SET firstRevision=%2
REM Below, we store the third parameter which is the second revision that is wanted.
SET secondRevision=%3
REM Below is the command for getting all the log messages between the first and the second revision that is wanted in the wanted repository and printing to a .txt file.
svn log -r %firstRevision%:%secondRevision% --limit %secondRevision% %urlOfRepository% > svnLog.txt
EXIT /B 0
I would be glad if someone can help me.
I can clarify the question more if it is needed so please do not hesitate to contact me via comments.
Thanks in advance.
Thanks to Kostix the answer is:
svn info -r HEAD --show-item revision %URL%
And I have written a script to solve my problem. Here it is:
#ECHO OFF
REM This Script writes the revision count of a specific SVN repository
REM Below, we store the first parameter which is the URL of the Repository that is wanted.
SET urlOfRepository=%1
REM Below, is the command that returns the count of revisions in the specifically given SVN repository and writes to a .txt file
svn info -r HEAD --show-item revision %urlOfRepository% > svnCountOfRepoRevisions.txt
EXIT /B 0

There's no need to do it that complicated—a mere
svn log -r HEAD:1 %URL%
should work.
The special HEAD revision is automatically the last one in the repository, and the revision 1 is the first one (obviously).
Subversion is smart enough to skip revisions in which the URL does not
exist, so, say, if it was added in revision 42, svn log won't complain there is no URL in the revision range [41…1].
You can obtain more info by running
svn help log
in your console window.

Related

rsync with --fake-super not preserving owner after restore - Monterey/Synology DS920+/rsync 3

Working through a backup script debug backup/restore on:
macStudio M1 / macOS Monterey <-> Synology DS920+
On the mac, I've downloaded HomeBrew rsync 3.2.4
On the synology, I'm running what it shipped with - rsync 3.1.2
For debug, I used /Volumes/Recovery which has files with
owner set to root and group set to wheel.
src="/Volumes/Recovery/"
dest="$userID#$remoteIP::NetBackup/MacStudio1/Volumes/Recovery/
restore="/tmp/RestoreBackup/"
userID is has admin privileges on the NAS.
rsync services are enabled on the NAS.
user directories are enabled on the NAS.
Backup:
rsync -ahX --delete -M--fake-super $src $dest
Restore:
rsync -ahX --delete -M--fake-super $dest $restore
It all seems to work without error. Files are on restore as expected except I'm seeing the files have owner set to my ID.
for example, ls -laR shows (abridged) :
/Volumes/Recovery/E4A28DF2-7007-4ED8-A427-320FCCA8AC36/usr/standalone/firmware:
-rw-rw-rw- 1 root wheel 1821914899 Jun 4 11:42 arm64eBaseSystem.dmg
/tmp/RestoreBackup//E4A28DF2-7007-4ED8-A427-320FCCA8AC36/usr/standalone/firmware:
-rw-rw-rw- 1 myID wheel 1821914899 Jun 4 11:42 arm64eBaseSystem.dmg
I've looked at the rsync man (more than once) and I see words like "To affect the remote side of a remote-shell connection...".
However, I'm not sure how to apply that to a backup or a restore.
Do I want to effect the remote side on the backup?
Do I want to effect the remote side on the restore?
Any guidance on what I should have set the options to?
So looks like I'm not getting any responses. Guess I'll wrap this up with my observations.
In testing I've done on a user directory (with test data files), the rsync is working to save and restore files with extended attributes (I verified they got set and that they matched on restore). So I think the overall switches on the rsync commands are correct.
The problems I'm seeing on backing up and restoring the "Recovery" volume have the following issues:
All regular files have the wrong "owner". The groups look correct.
The one linked directory has the wrong "owner" and the wrong "group".
I believe (1) problem is caused because I need to use sudo rsync on the restore. I'm guessing that the files that are backup up have the correct owner/group in metadata, but the restore doesn't have the authority to set the owner to 'root'. I tried using sudo briefly and it died with some errors I didn't quite understand. I believe I need to set up the etc/sudoers file with some information. The (2) problem may partially go away if I fix (1) or it may need some additional rsync flags to do with linked files and directories.
Overall, my backup script is working, but I'm now starting to question if I know enough to know what to backup on macOS. A rather length article by the CCC folk seems to explain this but it leaves me feeling I don't know enough above macOS data structures and it seems some of this may change over time when new version are released. I had started with the idea of just backuping up everything under /* (Macintosh HD), and perhaps this would work, though there are at least somethings that need to be excluded (like /Volumes/* and perhaps /tmp/* ). Also noticed that there is a /System tree that doesn't show up with ls /* that CCC folk say to leave alone. So not exactly got a good feeling I understand what I need to know.
So for the moment I'm going to sideline this effort. I've got Time Machine running to my NAS and I need to get the NAS backed up to a cloud first. My fall back positions are either (1) to just be dependent on TimeMachine only, (2) to buy and use CCC as a secondary backup, or (3) to create a backup with just my user directories as a secondary backup - which will require my reinstalling any 3rd party software in the event that I can't recover with Time Machine.

Which means distributing a modified program as patches?

I've read articles from the GNU project about open-source and other licenses. Some licenses allow you to post your changes as patches, not complete source code (for example Q Public License or gnuplot license). What does it mean? What do such patches look like? Can you get an example?
I do not want to focus on the legal situation, but on the programming - general definition, etc.
A patch is the result of a diff between a reference source tree (typically the original version of a project) and your modified version.
It's typically obtained with the POSIX diff command. But nowadays, with the ubiquitous use of versioning tools like SVN, Mercurial or git, the patch is generally generated with these tools (svn diff, hg diff, git diff, etc.)
On the receiver end, the patch is typically applied with the POSIX patch command.
Here is an example. Let's suppose you are working on a project (the orig_version directory below). Before making any change, you wisely create a copy of it (the my_version directory below) and modify a file from the copy:
cp -a orig_version my_version
# Change "This is the original version"
# ... to "This is my modified version"
$ vi my_version/README.txt
Let's see the differences:
$ diff -ruN orig_version my_version
diff -ruN orig_version/README.txt my_version/README.txt
--- orig_version/README.txt 2021-02-16 10:53:05.303423169 +0100
+++ my_version/README.txt 2021-02-16 10:53:00.243495007 +0100
## -1 +1 ##
-This is the original version
+This is my modified version
# Rredirect this output so as to
# create a patch file we can send
$ diff -ruN orig_version my_version > /tmp/my.patch
The output above shows the difference between the two directory trees. We have put that difference in a file that we can later send (e.g. by mail) to someone else who will then be able to take a look at the changes and apply them with patch:
# First we create a copy of our project
$ cp -a orig_version test_version
$ cd test_version
$ cat README.txt
This is the original version
# Then we apply the patch
$ patch -p1 < /tmp/my.patch
patching file README.txt
# Let's see the result
$ cat README.txt
This is my modified version
Note: since we are in the test_version directory, we used the -p1 option so that patch ignores the first element of the file paths found in the output of diff (--- orig_version/README.txt becomes --- README.txt, same for the +++ line).
25 years ago, people used to send and receive patches by mail and apply them like I just shown. Today, with the advent of distributed version control systems and of websites like Bitbucket and Github, people clone repositories, use their tool to pull the last changes, to get a diff, to push their changes and they send pull requests instead of sending patches by mail.

What is the condition for iexpress restart

I use iexpress.exe to quickly create a simple installer based on a batch file. The IExpress Wizards provides the option "Only restart if needed".
But how can I tell from the batch file that a restart is required? I tried using exit code 3016 as in windows updates. But that doesn't work.
BTW: I call the batch file with
cmd.exe /c my.bat
The contents of my.bat:
exit /b 3010
I tried to get IExpress to recognize the return code. I think you want 3010, not 3016, though. Also the command would be:
exit 3010
[No /b – we want to return an exit code from cmd, not set errorlevel].
But it didn’t work, which makes me wonder if IExpress even bothers to check that.
Anyhow, I did a bit of investigation with Process Monitor. Immediately after the install process runs, it seems IExpress checks the PendingFileRenameOperations registry value to see whether files have been marked for rename (or deletion). If there are any, it determines that a reboot is needed, and takes the action you specified in your SED file (eg prompt the user for a reboot; or just reboot; or nothing).
In case you’re not familiar with it, the PendingFileRenameOperations registry value is a list of files to be moved or deleted on the next system boot.
You can use Sysinternals MoveFile to simulate one of these scheduled-at-next-startup renames. Add movefile.exe to your IExpress archive, and add a line like this in your batch file:
movefile.exe -accepteula foo bar
The actual filenames aren’t important – just use a file that you know is certain to not exist. (As long as you didn’t change directory in the batch file, that’ll still be a file in, eg, %temp%\IXP000.TMP.)
Note that you need to be running elevated for that (Run as administrator).
Worked well here. IExpress pops up after each run, prompting the user to reboot.

Preserve files/directories for rpm upgrade in .spec file(rpmbuild)

I wrote a .spec file on RHEL and I am building RPM using rpmbuild. I need ideas on how to handle the situation below.
My RPM creates an empty logs directory when it installs first time within the installation folder like below
/opt/MyInstallation-1.0.0-1/some executables
/opt/MyInstallation-1.0.0-1/lib/carries shared objects(.so files)
/opt/MyInstallation-1.0.0-1/config/carries some XML and custom configuration files(.xml, etc)
/opt/MyInstallation-1.0.0-1/log--->This is where application writes logs
When my RPM upgrades MyInstallation-1.0.0-1, to MyInstallation-1.0.0-2 for example, I get everything right as I wanted.
But, my question is how to preserve log files written in MyInstallation-1.0.0-1? Or to precisely copy the log directory to MyInstallation-1.0.0-2.
I believe if you tag the directory as %config, it is expected that the user will have files in there, so it will leave it alone.
I found a solution or workaround to this by hit and trial method :)
I am using rpmbuild version 4.8.0 on RHEL 6.3 x86_64. I believe it will work on other distros as well.
If you install with one name only like "MyInstallation" rather than "MyInstallation-version number-RPM Build Number" and create "logs directory as a standard directory(no additional flags on it)[See Original Question for scenario] Whenever you upgrade, you normally don't touch logs directory. RPM will leave its contents as it is. All you have to do is to ensure that you keep the line below in the install section.
%install
install --directory $RPM_BUILD_ROOT%{_prefix}/%{name}/log
Here, prefix and name are macros. That has to do nothing with underlying concept.
Regarding config files, the following is a very precise table that will help you guarding your config files. Again, this rule can't be applied on logs our applications create.
http://www-uxsup.csx.cam.ac.uk/~jw35/docs/rpm_config.html
Thanks & Regards.

iexpress not executing installer

I have an install.bat file and a resource folder. so long as these two files are in the same directory, if you run install.bat, it will install a my lwjgl game. so what im trying to do is make a self extracting file that when completed runs the launch.bat file. I have tried using iexpress, and got it working for the most part. i have added in all my files and such so it will extract to some directory and then i can run the install.bat file to get my program to work. thing is though, i want the exe i created with iexpress to launch install.bat when its finished. so, i tried using the option in iexpress that says it will execute a command when finished the "installation" (using quotes because its not the actual installation, just extracting the files to some directory specified by the user). when i get to the step where it says what i would like to execute during and after the "installation". during the installation i left blank. after the installation i chose the install.bat file. when i try to click next though, it tells me i must choose something for the command during the extraction. I don't have anything specific to do during the installation so i just said "echo." (without quotes). after i was done i tried running the installer. before it even prompted me for a folder to extract to, it told me that echo. could not be executed. so i went back into my installation (via a .sed file) and changed the "echo." to "pause". that didn't work either. i then read on another website that in order to run a file the way i would like to, i put the file name in both the during and after installation boxes. i tried doing that and it didn't work either. can anyone please help me?
If I understood your question correctly you will need to specify what the iexpress must do at the post install command option provided so that cmd.exe is used instead of command.com, eg:
cmd.exe /c filethatyouwanttorun.bat
Refer to the question: Create Batch file for iexpress.
You can use the SED file and then modify the self extraction directive. This will run the batch file that you wanted to run and then install the application. (If you have chosen the option to extract and run an installation in iexpress, a temp folder will be used for the extraction I suppose.)
I'm not sure I understand your question exactly but perhaps a few points would help:
If you want a "do nothing" command, you can use something like:
cmd /c echo.
There is no "command during the extraction". There's only an install program and a post install command. Both of these execute after extraction. If you only need to execute one batch file, put it in the install program line and leave the post install command blank.
You can't ask the user for an extraction path and execute a file. You can only do one or the other. (The install program could prompt the user and copy the files there, though.)

Resources