The motivation for this change is that we may enable MallocDebug when running tests, which is done via environment variables that we do not want to be passed on to the shell tools we execute.
Previously we would only pass the repository’s root to scm::info, and thus the check on the path passed in was enough, but today we are passing in paths for which we do not yet know the repository root, so the check should (also) be done for the path that ends up containing version control meta data.
We still do the initial check since it also rejects non-local paths, thus avoiding stat’ing paths on network file systems.
Building with clang 3.2 (binary distribution) results in “illegal instruction” when adding 3 seconds to the steady clock, so I just replaced the code.
The reason the code was using std::chrono was to be able to provide better debug output, as dispatch_time_t is an abstracted time representation (according to the documentation).
Starting with subversion 1.8 we get back relative paths from ‘svn status’ so we need to prepend the working directory path.
I also made a few minor stylistic changes while touching the relevant function.
These are now all prefixed with what they are obtaining variables for (scope, document, bundle, …) which makes it easier to analyze/refactor the code.
Also change document_t’s settings function to document_settings.
These variables are mainly for use in the window title. Not all variables make sense across SCM drivers, hence why it is now completely up to the driver, what variables it provides.
Ideally we would be able to remove arbitrary callbacks rather than the last one added, but for this we would need to introduce some sort of handle (the callback itself is a block so not suitable as handle). The push/pop API for callbacks is sufficient for our use-case though.
This is so that tests can use the exact same executable to create the repository, as is used to obtain status (svn repositories created with newer executables are often not backwards compatible).
This was previously public so that we could write tests for it, but since the test runner is linked with the object files, it can access symbols that has visibility set to hidden.
Normally we enable these on application launch when we receive an ‘application did become active’ notification, for tests though, this notification is lacking, but we do want it enabled for tests, and while we could do a constructor in the tests to enable it, it seems better to just enable it by default.
One issue is that if TextMate is launched “in the background” then it will still do SCM status gathering. Though long-term I may actually want to always have it enabled, even when TextMate is not active.
This ensures that when an scm::ng::info_ptr object has been disposed by the user, the associated callback will not be called (as no-one else will keep it retained).
When requesting SCM info for a path, we now always return the cached info for the first parent of the path, but if the first parent of the path is not the direct parent, we do a more thorough search (which involve disk access) in a background thread.
The latter is required because we may have nested repositories. E.g. asking for SCM info for /path/to/project/submodule/file will initially return the root project’s cached SCM info (if the submodule info hasn’t yet been added to the cache) but will then later invoke the callback with the submodule’s SCM info.
This is to be used when the application is in the background. Rather than completely disable updates, it might perhaps be better simply to increase the delay used to throttle updates.
Also change SCM implementation so that it doesn’t use objects with automatic storage, as the objects may be accessed from threads, which may run after objects with automatic storage has been destroyed.
This won’t perform any disk access on main thread. The previous API would check for the SCM-metadata directories on the main thread and also obtain the initial status and branch during creation.