Is there a command that searches a specified string over a Mercurial repository and displays revisions where it is found?
If not, are there any examples of how to implement it?
hg grep <string> will search your entire repository history for string.
Related
I'm trying to run git diff --no-index --numstat <string> <string> on Linux (Debian Docker container), but I'm failing in finding a way to achieve this. In essence I want to pass the files' contents as strings instead of their file paths. The goal is to retrieve the stats from the --numstat flag.
This command should be executable outside of a git repository/directory and on Linux. So far, I've found two solutions which lack the former requirements:
git diff --no-index --numstat /dev/fd/3 /dev/fd/4 3<<<$(echo "<string>") 4<<<$(echo "<string>"): This works on MacOS, but fails to work on Linux.
git diff --numstat $(echo <string> | git hash-object -w --stdin) $(echo <string> | git hash-object -w --stdin): which only works inside git repositories (got this partial solution from here)
Certainly there must be a way to achieve this, either via some git command or other bash concepts I'm unaware of. Any help would be great.
Thanks!
The reason that solution 1. isn't working is that /dev/fd/3 and /dev/fd/4 are symlinks and git diff does not follow symlinks but instead uses their link target string as their "content".
The only way to pass a string to git diff directly instead of a file is as stdin - which obviously only works for one of the files. So I see only two possible solutions to your problem:
write the strings to (temporary) files first, then pass them to git diff
use another tool, as suggested by #B--rian in the comment
Another, shorter version of 1. using process substitution would be:
git diff --no-index --numstat <(echo "<string1>") <(echo "<string2>")
Which unfortunately doesn't work either for the same reason/because git diff does not support process substitution, see https://stackoverflow.com/a/49636553/11932806
After a lot of search i could see that meId is a good diff tool for comparision in linux
I would like to use the meId for displaying the svn diff
I am new to linux as well as SVN
I just downloaded the meId and placed it on my desktop i am not sure what to do next ?
i could see 'svn diff -r 2165:2182 --diff-cmd meld' is used to do the trick
but i am not sure how to do this
Can some one guide me to get the diff of svn displayed in meID
Any help for this is greatly appreciated ..
You need to create a wrapper script as described here: SVN documentation
In the Meld wiki you can find a wrapper script used to merge with Meld: Meld wiki
You can find the command line usage of Meld in the documentation.
I have a file that's been modified recently. Rather than looking into each revision, is there an easier way to find out, in Mercurial, in which revision the file was last modified? Thanks.
Note that I am using command line in Linux.
This will give you the last time a change was made to a particular file (increase 1 to N to see last N changes):
hg log -l 1 ./path/to/file
The answer of Autopulated is exactly what you are looking for if you just want to have a look on the last revision for a file.
I just wanted to mention the grep command :
$ hg help grep
hg grep [OPTION]... PATTERN [FILE]...
search for a pattern in specified files and revisions
[...]
With hg grep, you can search a particular file or the whole repository at any revision or range of revision for a particular pattern.
It is the kind of command which is really helpful if you're searching for the revision in which a particular method or variable was introduced or removed for example.
So I want to compare this folder http://cloudobserver.googlecode.com/svn/branches/v0.4/Boost.Extension.Tutorial/libs/boost/extension/ with this http://svn.boost.org/svn/boost/sandbox/boost/extension/. I want to get a diff file as a result. These folders are under svn control but I'd prefer git styled diff file (like one shown here) I tried git diff but it seems not to work that way for web folders. So how to do the same thing with one command on Linux?
Update:
So we had a great answer. But it works strangely - it seems to me it shows that all files (same files) have all theire contents replaced with very same contents (while I know for sure that there were only like 3-4 code lines changed at all)...
Update 2:
To achieve what I really needed (dif file with only really changed lines, with git styling, on Linux) do:
$ svn export http://cloudobserver.googlecode.com/svn/branches/v0.4/Boost.Extension.Tutorial/libs/boost/extension/ repos2 --native-eol CRLF
$ svn export http://svn.boost.org/svn/boost/sandbox/boost/extension/ repos --native-eol CRLF
$ git diff repos repos2 > fileWithReadableDiff.diff
Once you have the source trees, e.g.
diff -ENwbur repos1/ repos2/
Even better
diff -ENwbur repos1/ repos2/ | kompare -o -
and have a crack at it in a good gui tool :)
-Ewb ignore the bulk of whitespace changes
-N detect new files
-u unified
-r recurse
You urls are not in the same repository, so you can't do it with the svn diff command.
svn: 'http://svn.boost.org/svn/boost/sandbox/boost/extension' isn't in the same repository as 'http://cloudobserver.googlecode.com/svn'
Another way you could do it, is export each repos using svn export, and then use the diff command to compare the 2 directories you exported.
// Export repositories
svn export http://svn.boost.org/svn/boost/sandbox/boost/extension/ repos1
svn export http://cloudobserver.googlecode.com/svn/branches/v0.4/Boost.Extension.Tutorial/libs/boost/extension/ repos2
// Compare exported directories
diff repos1 repos2 > file.diff
I'm trying to find the proper command in subversion to see a list of all the files that have changed (don't need to see the changes really) between branch/tag A and branch/tag B, etc.
How about svn diff --summarize <A> <B>
You may also use svn diff --help to get more options
and svn status --help to get explanations on all possible modification description letters ('A', 'M' etc.)
SVN DIFF is what you are looking for. Should be able to specify the urls to the different branches
svn diff http://domain.com/tags/A http://domain.com/tags/B