Another thing I was not aware of: SmartGit can present warnings reported from (pre-)commit-hooks in an alerting way.
Just add echo “warning:” as prefix to your message and it will result in a warning signpost and a modal dialog after commit.
I’ve filed a change-request to make this parsing of the messages case-insensitive.
We ran at work into the quite tricky problem to move the “pure” implementation of a feature to some other branch (a quickfix-release) without adding those features/bugfixes from the current master-branch. The feature branch was created some while ago and meanwhile updated from time to time with origin/master.
Discussed options were:
* manually copy the changes (since it was one directory and some minor adjustments in other CMakeLists.txts and some calls) –> much work, very error prone in terms of “Oh, I missed something”
* move to HEAD@target-branch and cherry-pick one-by-one all feature-commits (without merge-commits) –> lots of work, because 15+ commits
* some Git-way –> preferred by me, but I neve did something similar before – so: totally unknown
I chose the third option and tinkered in parallel while someone else tried the other path.
0. created “fake-feature-branch” on HEAD of the feature-branch
1. merged current state master-branch to it
2. created a diff as patch-file between HEAD@master and HEAD@”fake-feature-branch” by:
git diff fromHash toHash --binary > ../binary.patch
(–binary is important; else added ressources will be missing)
4. switch to HEAD@targetBranch
5. apply the patch (and suppress whitespace-errors) by:
git apply --whitespace=fix ../binary.patch
6. eventually fix conflicts if necessary
Yay, two commands to save the day! Around 170 files were affected, so manually doing the application of the changes was out of scope for me. There had to be a feasible Git-solution.
The first month of 2019 already passed. And we passed it with flying colors!
But let’s have a look at 2018 – a year full of challenges and success: I’ve worked full-time, organized and participated in advanced courses for Python and in Requirements Engineering (officially: IREB Requirements Engineering Foundation Level-approved) and pursued a new employment as software engineer.
And I wrote some software in my spare-time, as you can see in the graph for the public github-repositories. The gaps in the commits can be explained with the birth of my daughter and the time where I acquired the new job and moved nearly 900 km across the country. Yay! Nice personal projects were and are Cullendula and the Daily Coding Challenges, which I solve mostly with fully Unit-tested Python (3).
More new, hands-on knowledge was gained in the area of CMake and Qt-charts.
Well – 2018 was great. Let me make 2019 greater! 💪
Sometimes there is too much whitespace and tabs in my last commit.
In former times I used a VisualStudio-plugin, but this is not helpful there. So I wrote a small script (see on my github) which:
• replaces all tabs with four spaces
• removes all trailing whitespace
• converts line-endings to CRLF
I invoke it on the list of all changes files in my last commit in the git-repo with:
$ git diff --name-only HEAD~1 HEAD | xargs -L1 ../removeTrailing.sh
(first part gives you a list of changed files and then feeds it to the script for execution)
If some ‘sophisiticated’ tool like git-stats is too cumbersome to configure, just do some git-log and shell-magic:
$ git log --format='%aN' | sort | uniq -c | sort
4 Hans Wurst
6 Klaus Blume
6 Bernd Meier
26 Marcel Petrick
32 Ali Baba
37 Linus Torvalds
Ok, just noticed that git has something built-in:
$ git shortlog -sn
from: https://coderwall.com/p/pek-yg/git-statistics-for-repo-per-author – Thanks Marcin Olichwirowicz!
Searched for a usable NTP-library, which assorts well with Qt and stumbled over qntp. While fiddling around I noticed in their source some opportunities to improve the code. So I cloned the repo, did them and created my very first pull-request for open-source 🙂
(Side-note: currently mostly Python-code is pushed due to the daily coding-challenge. But C++/Qt is still my carthorse.)
I am currently traveling back from my very first paid educational leave. Proper selection, arrangement and preparation lead to some awesome impressions: about the capabilities of Python and about the city of Detmold.
Daniel Warner lead us – an assembly of five inquisitive men in the age-range from 30 to 60 – along the details and
specialties of that programming language. I learned much, in detail:
- basic structures; list comprehension
- classes; objects; overrides; imports; representation; init-method
- dictionaries for caching results (memoisation)
- decorators (nice for for printing, caching and thread-safety)
- descriptors, properties and slots, kwargs
- (multi-)inheritance and its quirks
- recursive functions; functional programming
- threads, synchronisation, atomic access
I put all the exercises (full script with my own annotations) into a Git-repository right from the beginning and published it: https://github.com/marcelpetrick/Python_FortgeschrittenenSeminar/.
Which also makes a nice view of the github-history 🙂
Python was chosen by me by intent: I see and plan for ways to use it with artifical intelligence (TensorFlow-binding ..); microcontroller-programming (ESP can run MicroPython) and for the Raspberry (currently the tumblr-upload-script for the catcam is also Python); for daily data-manipulation-tasks which are currently done more or less on Bash or AutoIt or Batch – and then: write it once, run it both on Linux and Win).
This was a great choice! And I want to thank my wife for supporting these stays absent from home and my plan to achieve the wanted education 🙂 And I got a small certificate – but that’s just icing on the cake.
My plan as first real exercise is to re-implement the “find all islands in the given map”-programming challenge. This will be fun. Getting to know some specialties and what properties/slots mean in Python-context (compared to the Qt-ones) was nice. And the decorators are a really powerful way to add special functionality to methods without bloating them and without blocking the view to the busines logic.
Archiving the whole directory is also an idea, but why not use the integrated functionality?
More hints: https://stackoverflow.com/a/5578292/1694302
export to a single file (bunlde):
git bundle create ../SAP_autoIt_bundle --all
git clone SAP_autoIt_bundle myClonedFolder
As always: some projects need a first (working) implementation and then over time you can improve them.
During lunch I was talking with a colleague about this tool. Then the idea to just use those actually changed files from the current implementation (means: the current branch in Git) shall be used as input. Et voila: consider it done!
Also added some fine-tuning to the call-parameter of the script itself, so it can be run as well with some custom string beside “todoM” (which is my marker).
Cleaning an implementation of properly tagged lines takes now a second – not minutes (like before!
Enjoy and have fun 🙂
Code can be found as always at https://github.com/marcelpetrick/cleanMyCode/blob/master/remove_todoM.sh