Peter Toft

1

votes
1

answer
67

views

git filter-branch - remove one of many submodules

I have been using git filter-branch a lot to get rid of legacy files, however for a bare git repo I cannot figure out how I can rewrite my git history where one of my git submodules is removed. I have a top-level repo 'Donald' and below 'Donald' I have four submodules 'Huey', 'Dewey', 'Louie' and 'P...
Peter Toft
1

votes
1

answer
131

views

Detect usage of STL in C++ [duplicate]

This question already has an answer here: How can I ensure no code uses an API? 5 answers I got an interesting question yesterday. I have some C++ code on Linux, which I might give to an Android-team. They asked whether I could omit usage of STL. This leads to a generic question of how you detect u...
Peter Toft
1

votes
2

answer
1.5k

views

Mercurial: “undoing” two or more commits

In How do I do a pristine checkout with mercurial? Martin Geisler discuss how to remove already Mercurial commit'ed files using: hg strip 'outgoing()' But what if I I want to keep my added files which went into 'outgoing()' - example: Two users a and b — starting on the same changeset User a: echo...
Peter Toft
7

votes
3

answer
1.8k

views

Git equivalent to hg update

Below is a small example with Mercurial and similarly with Git. I cannot understand how to make a hg update with Git: I have a small Mercurial setup with 4 commits - where I step back one commit hg init echo '1' > a.txt; hg commit -A -m '1. commit' a.txt echo '2' >> a.txt; hg commit -m '2. commit' a...
Peter Toft
2

votes
4

answer
2.7k

views

Impact of using extern “C” { on C++ code when using g++

When using G++ (e.g. version 4.5 on Linux) can anyone explain what will/can happen if a user writes a header file for a mixed C/C++ system like this: #ifdef __cplusplus extern 'C' { int myCPPfunc(some_arg_list....); /* a C++ function */ } #endif but here myCPPfunc() is a normal C++ function with a...
Peter Toft
2

votes
2

answer
295

views

Mercurial commit and merge

With Mercurial I often see a scenario where I need to gradually commit an push, but if another person commits in the middle of this then I get into a problem. Example: Assume the HG repo has four files a.txt, b.txt, c.txt, d.txt and we have two users Mickey and Goofy: Mickey does: $ echo 'change1'...
Peter Toft
6

votes
1

answer
183

views

git gc on bare repository does not clean up

I have a 2GB Git bare repo with 30000 commits. Unfortunally I have early added some large files over the years, which I now have cleaned up using git filter-branch - see e.g. this link. Identification of the culpits - see e.g. this link I have also cleaned away many old 'test try' branches using gi...
Peter Toft
4

votes
3

answer
837

views

Python parallel execution - how to debug efficiently?

Below is a Python problem, that demonstrates how to iterate a function func in parallel using multiprocessing.Pool. The are Np number of elements to iterate. The function func merely returns Np minus the index of the iterable. As seen I use a queue to return the values from the function, when runnin...
Peter Toft
7

votes
3

answer
1.8k

views

Mercurial: enforce “hg pull -u” before “hg commit”

I have in some cases a need to enforce that Mercurial-users have run hg pull -u before any hg commit can be allowed, i.e., hg pull will mean that the incoming queue is empty — and furthermore I also want that the person is using the head version of the branch. How can I set up such a restriction?...
Peter Toft
2

votes
1

answer
120

views

Wrap C++ to Python - where parts of the code is a shared library without source

I have a Linux .so-library secdyn.so with a headerfile without source. /* secdyn.h */ int sec2(int a); I want to wrap this to Python via Swig, thus I write a subdyn.h #include #include 'secdyn.h' int subdyn(int a,int debuglevel); and a subdyn.cpp #include 'subdyn.h' int subdyn(int a,int debuglevel)...
Peter Toft
3

votes
2

answer
1.8k

views

Git submodule for Linux and Windows

When using git submodule on Linux I might have a .gitmodules with one or more subsystems checked out from e.g. /mnt/gitrepos/subsystem1.git (central file based access). [submodule 'subsystem1'] path = subsystem11 url = /mnt/gitrepos/subsystem1.git/ I would like to support also a Windows user who can...
Peter Toft
10

votes
1

answer
518

views

Who ate my Python memory? [duplicate]

This question already has an answer here: Which Python memory profiler is recommended? [closed] 8 answers Generic question regarding Python-code. How can I most effectively locate the worst parts of my Python-code with respect to memory usage? See e.g. this small example def my_func(): a = [1] * (...
Peter Toft