Mercurial track changes of a line - mercurial

I am curious if there is a possibility to see the changes of a file, in an automatic way that have occurred to a line using Mercurial...
Concrete case: at some time in the past, a few months ago a line in our code (file: MainWindow.cpp line number 219) was changed by someone, and noone remembers when and what was there before, we just know that the stuff we have now is not working :( and we would like to see why (and most importantly when) that change is there. Browsing manually through the thousands of commits is not an option :(
Thx.

Yes, you can use hg annotate and default output of annotate will show you revision, when sting was changed last time
hg ann functions.php
0: <?php
0:
0: if ( ! isset( $content_width ) ) $content_width = 550;
0:
3: add_theme_support('automatic-feed-links');
6: add_theme_support('custom-background');
...
(first column is revision number). With -d option you can add date of revision to output
hg ann -d -n functions.php
0 Sat Aug 06 01:13:35 2011 +0600: <?php
0 Sat Aug 06 01:13:35 2011 +0600:
0 Sat Aug 06 01:13:35 2011 +0600: if ( ! isset( $content_width ) ) $content_width = 550;
0 Sat Aug 06 01:13:35 2011 +0600:
3 Wed Dec 14 04:01:33 2011 +0600: add_theme_support('automatic-feed-links');
6 Sun Jun 24 15:20:24 2012 +0600: add_theme_support('custom-background');
With revision number (only) you can see file at the state of this revision: hg cat -r N <filename>
But if you want to see all history of changes of string in question (and you have some current or historical content, not only number), you can use hg grep

Try:
hg annotate MainWindow.cpp
It's similar to svn blame, and displays all lines of the file with the number of revision when it changed.

Related

Anaconda lib duplicates of libonedal_core

I'm looking through my Anaconda folders noticing what seem to be many duplicates. All these dupes are modified at the same time, all seem to have a version convention. They are not symlinks.
In ~/opt/anaconda3/lib and ~/opt/anaconda3/pkgs/dal-2021.5.0-hecd8cb5_782/lib
Are these in fact dupes? If yes, what's the safest way to remove the dupes? I've already run conda clean -ap and
These files are very likely symbolic links (softlinks) to a single file. It would be better to examine such files with a ls -lh command from a shell, rather than through a GUI. For example, if I look at libmamba* in my base environment, I see
$ ls -lh ~/miniconda3/lib/libmamba*
-rwxrwxr-x 2 mfansler staff 3.2M Aug 23 16:32 libmamba.2.0.0.dylib
lrwxr-xr-x 1 mfansler staff 20B Sep 29 17:05 libmamba.2.dylib -> libmamba.2.0.0.dylib
lrwxr-xr-x 1 mfansler staff 20B Sep 29 17:05 libmamba.dylib -> libmamba.2.0.0.dylib
where the arrows (->) represent symbolic links. Also notice how those are only 20 bytes.

How do I remove escape sequences (ESC[0;33m) from hg's output?

I'm trying out Mercurial. When I run hg log in the terminal, I see this output, paged through a pager, probably less:
ESC[0;33mchangeset: 1:82e55d328c8cESC[0m
tag: tip
user: mpm#selenic.com
date: Fri Aug 26 01:21:28 2005 -0700
summary: Create a makefile
ESC[0;33mchangeset: 0:0a04b987be5aESC[0m
user: mpm#selenic.com
date: Fri Aug 26 01:20:50 2005 -0700
summary: Create a standard "hello, world" program
How do I configure Mercurial so that I don't see escape and control sequences like ESC[0;33m and ESC[0m
These sequences are meant to enable colour output in the terminal. You can disable colour by adding --color=never, like this:
hg log --color=never
Even better, you can change the pager to enable recognising these colour sequences. For example, you can use less -R on systems that have less. Modify ~/.config/hg/hgrc or ~/.hgrc to include this section:
[pager]
pager = less -R

hg / mercurial: how to get all commits which goes to new app release?

I'm using hg flow (similar to git flow) approach.
I need all commits between my current branch "release/2.0.0" latest commit and previous "develop" commit in point there "release/1.0.0" was started.
In short words: I want all commits which will go in new release candidate package.
Please take a look at screenshot.
I want all commits which are inside red line. They are all changes since previous app release.
This is actually very easy with mercurial: revsets to the rescue!
You basically want to include everything which happend prior to your current dev release, but exclude that stuff which happend already prior to the last release:
hg log -r"ancestors(DEVREV) and not ancestors(RELEASE)"
where DEVREV is the revision of your current one and RELEASE the revision of the last release.
E.g.:
ingo#aeolus:~/hg-test$ hg log -G -T"{rev}: {desc}\n"
# 8: New release
|
| o 7: New dev stuff
| |
o | 6: Merge 4
|\ \
| | o 5: Add cc
| |/
| o 4: Add bb
| |
o | 3: Add d
| |
o | 2: Add c
| |
o | 1: Add b
|/
o 0: Add a
ingo#aeolus:~/hg-test$ hg log -r"ancestors(7) and not ancestors(8)"
changeset: 5:ce0558751c5a
user: planetmaker <planetmaker#openttd.org>
date: Wed Aug 22 16:14:12 2018 +0200
summary: Add cc
changeset: 7:78f338d1c8fa
parent: 5:ce0558751c5a
user: planetmaker <planetmaker#openttd.org>
date: Tue Oct 09 13:02:20 2018 +0200
summary: New dev stuff
You might want to try --style=changelog with the appropriate revset though.

Error 403 wont load any files in project folders

Can someone please explain with clear step by step instructions to a noobie, why is my console giving me these errors for some of my files on a project? I usually get them for external style sheets sometimes images and external .js documents.
Makes no sense to me.
Console shows Error: 403 Forbidden for each of them...
My noobie intuition says something is not right with my permissions for my sites directory or something among these lines. I dont know how to check
If you are using a LAMP stack for web server then you can face that problem.
First check the permission of all the files in the subsequent directory -
Let say that these are four external js in your html file like as :-
<script src="/js/file1.js"></script>
<script src="/js/file2.js"></script>
<script src="/js/file3.js"></script>
<script src="/js/file4.js"></script>
and you are getting errors for file1.js and file2.js then goto the js directory and check their permissions :-
user#host js $ ls -la
total 188
drwxrwxr-x 2 user user 4096 Jul 19 01:51 .
drwxrwxr-x 6 user user 4096 Jul 19 01:39 ..
-rw-rw-r-- 1 user user 55258 Feb 13 2014 file1.js
-rwxrw-r-- 1 user user 55258 Feb 13 2014 file2.js
-rwxrw-r-- 1 user user 55258 Feb 13 2014 file3.js
-rw-rw-r-- 1 user user 55258 Feb 13 2014 file4.js
-rw-rw-r-- 1 user user 29110 Feb 13 2014 bootstrap.min.js
If required change their permission with chmod and chown command.

Having description and contact at Mercurial web page

Currently, I am in the progress of migrating CVS to Mercurial.
http://jstock.hg.sourceforge.net/hgweb/jstock/
I would like to have contact and description information in the mercurial page.
I look at https://www.mercurial-scm.org/wiki/PublishingRepositories#Putting_useful_information_in_the_index_page
But, it seems that, modification on C:\Projects\jstock\.hg\hgrc doesn't have any effect at all. push will not update anything in sourceforge server.
So, does this mean the only way is to remote access to sourceforge mercurial server and modify the hgrc file manually?
I try to ssh to the remote machine.
[yccheok#shell-22003 .hg]$ pwd
/home/scm_hg/j/js/jstock/jstock-cloud/.hg
[yccheok#shell-22003 .hg]$ ls -al
total 56
drwxrwsr-x 3 yccheok jstock 1024 Nov 30 15:29 .
drwxrwsr-x 3 yccheok jstock 80 Nov 30 15:13 ..
-rw-rw-r-- 1 yccheok jstock 57 Nov 30 15:13 00changelog.i
-rw-rw-r-- 1 yccheok jstock 93 Nov 30 15:29 branchheads.cache
-rw-rw-r-- 1 yccheok jstock 23 Nov 30 15:13 requires
drwxrwsr-x 3 yccheok jstock 1024 Nov 30 15:29 store
-rw-rw-r-- 1 yccheok jstock 317 Nov 30 15:29 tags.cache
-rw-rw-r-- 1 yccheok jstock 7 Nov 30 15:29 undo.branch
-rw-rw-r-- 1 yccheok jstock 0 Nov 30 15:29 undo.dirstate
[yccheok#shell-22003 .hg]$
But not able to find hgrc file.
The .hg/hgrc file contains local settings and is not itself a versioned file. These settings do not travel from one repository to the other by hg clone, hg push or hg pull commands.
If you want to edit the hgrc file of your source forge repository, you have to use Sourceforge's interactive shell service.
My guess would be that the sourceforge server doesn't consider your repo's .hg/hgrc file due to trust rules. Their webserver user would need to have a trust block saying they trust .hgrc files from you, which is a risk as it allows you to have code executed as their webserver user.
If there's a way to do this the solution is going to come from somewith with strong sourceforge-fu, not mercurial-fu.