I want to find all the merge arrows pointing to a certain version in a script. When I describe the version of the element with the following command:
ct describe filename##/main/some_branch/3
I get in the result the following:
Hyperlinks:
Merge <- filename##/main/other_branch/2
I want ct describe to output only the relevant information to be used in my script, ie. the versions where the merge arrows come from. In my case, the output should look simply like this:
filename##/main/other_branch/2
I didn't find any relevant parameters in the -fmt from the man page. Is there any way of doing it?
The only option in the fmt_ccase man page would be
%[hlink:filter]p
Displays the hyperlink source and target, with an arrow pointing from the source to the target. The optional H argument lists only the hyperlink names.
You can optionally specify a filter string, preceded by a colon. This filter if present, restricts the output to names that match the filter string. Case is considered when matching the string.
If this doesn't work, you have to resort to grep/awk commands in order to extract those version from the cleartool describe output.
The cleartool descr -ahlink restricts a bit the output.
–ahlink
The listing includes the path names of the objects hyperlinked to pname, annotated with → (listed object is the to- object) or ← (listed object is the from-object).
For example:
-> M:\gamma\vob1\proj\include\db.c##\main\52 <- M:\gamma\vob1\proj\bin\vega##\main\5
Beside the full script option, you can have a look at external third-party tools like R&D Reporter, which can vizualize and export those same hyperlinks.
However:
this is a commercial tool
depending on the export output and what you want, you might end up parsing just another output to extract what you need.
For more on that tool, contact Tamir Gefen.
Related
I know I can use "SPC p f" to search for a file in the current project, which means git repository for me. Now, in my current project we have multiple git repos, and I'd like to search for files in all of them. Luckily, they all reside in the same directory (e.g. ~/projects/x/).
Is there a command in Spacemacs that lets me search for files in all the git repos under ~/projects/x?
I believe you can do it with SPC s f. When you activate it:
Prompts you to select a directory to search
Allow you to enter a search string, showing results in the HELM window
In general, SPC s shows all keybindings for general search, where f is for files.
I dug through the available helm commands again and found helm-projects-find-files, which does exactly what I want.
I put this in ~/.spacemacs into the function dotspacemacs/user-config:
(setq-default helm-locate-project-list (list "~/projects"))
(spacemacs/set-leader-keys "fm" 'helm-projects-find-files))
For searching in those files, you can use spacemacs/helm-project-smart-do-search-in-dir:
Put this somewhere in ~/.spacemacs:
(defun mine/search-in-projects ()
"Search in all my projects (i.e. what is checked out in ~/projects)"
(interactive)
(spacemacs/helm-project-smart-do-search-in-dir "~/projects"))
And this in ~/.spacemacs into the function dotspacemacs/user-config:
(spacemacs/set-leader-keys "sm" 'mine/search-in-projects)
(I used SPC-sm as key combination because the project name starts with an "m").
Oh, I just realized I can just put a marker that projectile respects (like a .projectile file) into my ~/projects/x directory. Now I can switch to the ~/projects/x project, and still am able to also narrow it to specific sub-projects by selecting e.g. ~/projects/x/p1/.
So all I needed to do was:
touch ~/projects/.projectile
Update: I realized that when doing this, I can't narrow down to a sub-project. So it's not really the best answer.
You can put this in your .spacemacs to bind SPC p f to search all projects.
(spacemacs/set-leader-keys "pf" 'helm-projectile-find-file-in-known-projects)
This question is related to Swift and Objective-C.
I want to create variables from Constant Strings. So, in future, when I change name of a variable though out app, I just need to change it at one place, it must be changed, wherever it is used.
Example:
I have user_id in 14 files, if I want to change user_id into userID I have to change in all 14 files, but I want to change at once place only.
One way to do this would be to use the Xcode build process and add a script (language can be of your choice, but the default is a BASH script)
Create string constant text file where you define all your variables you want to change in some format that expresses the change you want to make, for example:
"variable_one_name" = "new_variable_one_name"
Depending on how 'smart' you wanted your script to be you could also list all your variables and include some way of indicating when a variable is not to be replaced.
"variable_one_name" = "new_variable_one_name"
"variable_two_name" = "DO_NOT_CHANGE"
Run a pre build script on you project that reads in the string constant text file and then iterates through your source files and executes the desired replacement. Be careful to limit the directories you search to you OWN source files!
build project...
This would allow you to manage your constants from one place. However it clearly is only going to help you after you have created a project and written some code :)
BASH string replacement
Adding a run script to the Xcode build process
Suppose I have the following code in Go:
foo, bar := someFunc(baz)
I would like to create a Vim function to check type of foo or bar when editing a file.
Is there any tool or reliable source of information for functions from Go's packages I could use or? As for the functions declared in the file I'm editing I was thinking about simply parsing all the functions declared in that file.
You are looking for something like godef
If the -t flag is given, the type of the expression will also be
printed. The -a flag causes all the public members (fields and
methods) of the expression, and their location, to be printed also;
the -A flag prints private members too.
I know it is being used by various vim and emacs scripts.
The Go Oracle does this and much more.
vim-go is a complete vim setup for Go.
It includes integration with the previously mentioned godef (as :GoDef) and Go oracle (as :GoImplements, :GoCallees, :GoReferrers, etc) as well as other tools.
In D3, suppose I have a file called foo and I want to write the contents of the file out to /var/tmp/bar. The documentation leads me to believe that it should be possible to make D3 write the file to the file system by changing the D pointer into a Q pointer, but I can't figure out how to make this happen.
You can do this at least a few ways.
1) You don't want to change a d-pointer to a q-pointer, you just want to create a q-pointer. In other words there's no need to have a d-pointer first to access the host file system. So your q-pointer called 'bar' will look like this:
Q
/var/tmp/bar
With that you can simply:
copy foo
to: (bar
Note that in this case 'bar' is a host OS folder/directory, not a file. A D3 'file' is a table that has multiple records. That translates to a host OS directory with multiple files.
Options are available on the Copy command to suppress the display of item IDs (keys) as records are copied (see docs).
2) You don't even need a q-pointer:
copy foo
to: (/var/tmp/bar
3) Similarly in code you can use the q-pointer or you can use the direct path:
open 'bar' to f.bar1 ...
open '/var/tmp/bar' to f.bar2 ...
==
The path syntax is using a mechanism called the OSFI (see docs). With this syntax you can specify a driver. The default driver called "unix:" converts attribute marks to the *nix EOL which is a line-feed x0A. If you're on Windows the default is "dos:" which converts attribute marks to CRLF x0D0A. You can force a non-default by preceding the path with the driver. So to create a DOS-format file in Unix/Linux, use dos:/var/tmp/bar. The default drivers also convert between tab and 4-spaces (see docs). Values and subvalues are not converted but a new driver can be created to do so. Use the 'bin:' driver to avoid conversions, so bin:/var/tmp/bar will not convert #am (xFE) to x0A, etc.
If you need more detail I'll be happy to add to this.
I am using OCLint static code analysis tool for objective-C and want to find out how to customize rules? The rules are represented by set of dylib files.
In lieu of passing configuration as arguments (see Jon Boydell's answer), you can also create a YML file named .oclint in the project directory.
Here's an example file that customizes a few things:
rules:
- LongLine
disable-rules:
rulePaths:
- /etc/rules
rule-configurations:
- key: LONG_LINE
value: 20
output: filename
report-type: xml
max-priority-1: 10
max-priority-2: 20
max-priority-3: 30
enable-clang-static-analyzer: false
The answer, as with so many things, is that it depends.
If you want to write your own custom rule then you'll need to get down and dirty into writing your own rule, in C++ on top of the existing source code. Check out the oclint-rules/rules directory, size/LongLineRule.cpp is a simple rule to get going with. You'll need to recompile, etc.
If you want to change the parameters of an existing rule you need to add the command line parameter -rc=<rulename>=<value> to the call to oclint. For example, if you want the long lines rule to only activate for lines longer than 150 chars you need to add -rc=LONG_LINE=150.
I don't have the patience to list out all the different parameters you can change. The list of rules is here http://docs.oclint.org/en/dev/rules/index.html and a list of threshold based rules here http://docs.oclint.org/en/dev/customizing/rules.html but there's no list of acceptable values and I don't know whether these two URLs cover all the rules or not. You might have to look into the source code for each rule to work out how it works.
If you're using Xcode script you should use oclint_args like this:
oclint-json-compilation-database oclint_args "-rc LONG_LINE=150" | sed
's/(..\m{1,2}:[0-9]:[0-9]*:)/\1 warning:/'
in that sample I'm changing the rule of LONG_LINE to 150 chars