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

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

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.

COPR fedoraproject.org builder refuses to download sources specified in my .spec file

I have a package build in https://copr.fedoraproject.org. My spec for rpkg is here. The build is failing with the following
Generated rpkg config:
[rpkg]
preprocess_spec = True
[git]
anon_clone_url = https://github.com/%(repo_path)s
[lookaside]
download_url = https://${git_props:remote_netloc}/repo/pkgs/%(repo_path)s/%(filename)s/%(hashtype)s/%(hash)s/%(filename)s
Writing config into /var/lib/copr-rpmbuild/workspace/workdir-ce16hwto/.config/rpkg.conf
Running: rpkg srpm --outdir /var/lib/copr-rpmbuild/results --spec /var/lib/copr-rpmbuild/workspace/workdir-ce16hwto/skupper-router
cmd: ['rpkg', 'srpm', '--outdir', '/var/lib/copr-rpmbuild/results', '--spec', '/var/lib/copr-rpmbuild/workspace/workdir-ce16hwto/skupper-router']
cwd: /var/lib/copr-rpmbuild/workspace/workdir-ce16hwto/skupper-router
rc: 1
stdout: Wrote: /var/lib/copr-rpmbuild/results/skupper-router.spec
stderr: git_dir_pack: archiving /var/lib/copr-rpmbuild/workspace/workdir-ce16hwto/skupper-router:
commit cb2a29004b1660168cc4a6894e521b0cf71cb25d (HEAD -> jd_2022_03_15_rpm, origin/jd_2022_03_15_rpm)
Date: Sat Apr 9 01:04:32 2022 +0200
add static build rpm
git_dir_pack: Wrote: /var/lib/copr-rpmbuild/results/skupper-router-cb2a2900.tar.gz
error: Bad source: /var/lib/copr-rpmbuild/results/qpid-proton-0.37.0.tar.gz: No such file or directory
Copr build error: git_dir_pack: archiving /var/lib/copr-rpmbuild/workspace/workdir-ce16hwto/skupper-router:
commit cb2a29004b1660168cc4a6894e521b0cf71cb25d (HEAD -> jd_2022_03_15_rpm, origin/jd_2022_03_15_rpm)
Date: Sat Apr 9 01:04:32 2022 +0200
add static build rpm
git_dir_pack: Wrote: /var/lib/copr-rpmbuild/results/skupper-router-cb2a2900.tar.gz
error: Bad source: /var/lib/copr-rpmbuild/results/qpid-proton-0.37.0.tar.gz: No such file or directory
(full log at https://download.copr.fedorainfracloud.org/results/jdanek/skupper-router/srpm-builds/04126008/builder-live.log.gz)
On my machine, running rpkg srpm succeeds.
I searched around and it seems to me that COPR should be willing to download sources if they are distributed over https, which mine are.
Can I use the lookaside cache feature, somehow, for my sources?
Normally, downloading the qpid-proton file by https would work in Copr. It's done by rpmbuild (being invoked by rpkg) if there is %_disable_source_fetch 0 defined in rpm macros somewhere.
The problem is that one of the lines in the spec file is: %undefine _disable_source_fetch which disables this behavior for the given spec file.
Your build fails on the git_dir_pack (rpkg-util, aka rpkg failure). This happened before the rpmbuild process even started.
A few weeks ago we migrated the Copr builders to Fedora 35,
and thus also to rpkg-util v3. Feel free to take a look how
to fix similar issues.
Or perhaps contact the rpkg-util upstream for a guidance.
The problem is that the sources file apparently must be downloaded from the lookaside cache. So, let's create ourselves one. Or at least, the appearance of one.
First, download the required source archive to your computer, to the git repo checkout dir, and do an "offline upload" using rpkg
wget https://www.apache.org/dist/qpid/proton/0.37.0/qpid-proton-0.37.0.tar.gz
rpkg upload --offline qpid-proton-0.37.0.tar.gz
This creates sources file. Commit that to the repo. Undo the edit to .gitignore that this also did. (If that rpkg command fails, ignore that as long as the sources file got created.)
Create new file rpkg.conf with the following content, and commit it to repo.
[lookaside]
download_url = https://www.apache.org/dist/qpid/proton/0.37.0/%(filename)s
Now push that and build it in COPR.
(Don't get confused by the obviously wrong download_url printed below; our rpkg.conf in the repo directory is overriding that.)
Running: git checkout jd_2022_03_15_rpm_cstdint
cmd: ['git', 'checkout', 'jd_2022_03_15_rpm_cstdint']
cwd: /var/lib/copr-rpmbuild/workspace/workdir-rmzys1po/skupper-router
rc: 0
stdout: branch 'jd_2022_03_15_rpm_cstdint' set up to track 'origin/jd_2022_03_15_rpm_cstdint'.
stderr: Switched to a new branch 'jd_2022_03_15_rpm_cstdint'
Generated rpkg config:
[rpkg]
preprocess_spec = True
[git]
anon_clone_url = https://github.com/%(repo_path)s
[lookaside]
download_url = https://${git_props:remote_netloc}/repo/pkgs/%(repo_path)s/%(filename)s/%(hashtype)s/%(hash)s/%(filename)s
Writing config into /var/lib/copr-rpmbuild/workspace/workdir-rmzys1po/.config/rpkg.conf
Running: rpkg srpm --outdir /var/lib/copr-rpmbuild/results --spec /var/lib/copr-rpmbuild/workspace/workdir-rmzys1po/skupper-router
cmd: ['rpkg', 'srpm', '--outdir', '/var/lib/copr-rpmbuild/results', '--spec', '/var/lib/copr-rpmbuild/workspace/workdir-rmzys1po/skupper-router']
cwd: /var/lib/copr-rpmbuild/workspace/workdir-rmzys1po/skupper-router
rc: 0
stdout: Downloading qpid-proton-0.37.0.tar.gz from jiridanek/skupper-router at www.apache.org:
Wrote: /var/lib/copr-rpmbuild/results/skupper-router.spec
Wrote: /var/lib/copr-rpmbuild/results/skupper-router-0.0.git.3560.d7714b9c-2.0.0.fc35.src.rpm
stderr: git_dir_pack: archiving /var/lib/copr-rpmbuild/workspace/workdir-rmzys1po/skupper-router:
commit d7714b9cac0641d4e34c0774b875fcb67cee8793 (HEAD -> jd_2022_03_15_rpm_cstdint, origin/jd_2022_03_15_rpm_cstdint)
Author: Jiri Daněk <jdanek#redhat.com>
Date: Wed Apr 13 17:13:22 2022 +0200
add autopack
git_dir_pack: Wrote: /var/lib/copr-rpmbuild/results/skupper-router-d7714b9c.tar.gz
Output: ['skupper-router.spec', 'qpid-proton-0.37.0.tar.gz', 'skupper-router-0.0.git.3560.d7714b9c-2.0.0.fc35.src.rpm', 'skupper-router-d7714b9c.tar.gz']
Success!

How to run a html file on localhost (any port)

I am creating a website using HTML, CSS and js with java for server side. I need to run it on localhost.
Extra info: I am using mac os x 11 (el capitan)
I have already tried python and node.js but it clashes with java
So i need a technology that won't clash with java and will help me localhost on mac
IIRC macOS comes with PHP preinstalled, and PHP has built-in web-server which should be enough for serving static content.
So, open Terminal.app and then:
cd your/project/dir
php -S localhost:8080
After than you can navigate to http://localhost:8080/ and see your site in the browser (given you have index.html in your project, otherwise there will be "Not Found" message).
There are more advanced and/or less terminal-oriented ways, of course, but since you already tinkering with python and node, another terminal command should not be a problem.
BTW, you might want to look at that terminal window from time to time, as it outputs nice log of what things were requested from server. Good if you want to check for invalid references, 404 errors, etc. Here is a sample output:
$ php -S localhost:8080
PHP 7.3.6 Development Server started at Sat Jun 22 20:00:28 2019
Listening on http://localhost:8080
Document root is /private/tmp/test
Press Ctrl-C to quit.
[Sat Jun 22 20:00:32 2019] [::1]:51640 [200]: /
[Sat Jun 22 20:00:32 2019] [::1]:51641 [200]: /style.css
[Sat Jun 22 20:02:35 2019] [::1]:51670 [404]: /oops.html - No such file or directory
As you can see, root folder (/, which was translated to index.html in my case) and a stylesheet (style.css) were requested and successfully delivered (code is 200). But non-existent file oops.html resulted in error (code is 404).
You can use caddy
Install: brew install caddy
To serve static files from the current working directory, run:
caddy file-server --browse --listen :2015
Caddy's default port is 2015, so open your browser to http://localhost:2015.

MongoDB: mongoimport isodate on Ubuntu 14.04LTS

Platform: Ubuntu 14.04 LTS 64bit
Python installed, can't remember its version right now: I can update this question later
....$>sudo mongod --versiondb
version v2.4.9 git
git version: nogitversion
....$>sudo service mongodb status
start
My dbpath variable set on /etc/mongod.config is equals to /home/utente/OFS/datasource. I gave right permissions with chmod. From mongodb.log file I can see last line like:"...waiting for connection on port 27017"
Open a terminal, trying to import the json here below:
{ "_id":ObjectId("572f36bcb69df6b4280cee68"),
"formatoPreferito":ObjectId("57121b0d1dab7d841d149ed0"), "nome":"fra",
"cognome":"back", "dataNascita":ISODate("1987-09-17T22:00:00Z"),
"email":"test#test.com",
"password":"$2a$10$4LR/kFI.FHPXHug7Jo9z0.mSgFqT4j4ZMeM.x1MdBfp5HGAFCvdOG",
"ereader":"kindle",
"token":"$2a$10$WBT5.ylZiRkfSZM./7XUtemllTNN5jaJJy8KsVISvJTvUyUmP49ki",
"dataRegistrazione":ISODate("2016-05-08T12:53:15.262Z"), "attivo":true
}
With the command:
mongoimport --db ofs --collection utenti --host localhost --port 27017 --drop --file /home/utente/OFS/load.utenti.json
With the output:
connected to: localhost:27017
Tue May 24 00:04:27.151 dropping:
ofs.utenti
Tue May 24 00:04:27.152 exception:BSON representation of
supplied JSON is too large: code FailedToParse: FailedToParse: Bad
characters in value: offset:149
Tue May 24 00:04:27.152
Tue May 24 00:04:27.152 exception:BSON representation of supplied JSON is too large: code FailedToParse: FailedToParse: Bad characters in value: offset:149
Tue May 24 00:04:27.152 imported 0 objects
Tue May 24 00:04:27.152 ERROR: encountered 2 error(s)s utente#utente-X551CAP:~/OFS$Tue May 24 00:04:27.152 Tue May 24 00:04:27.152 check 0 0
offset 149, watched on text editor, is the position of the ':' character on the dataNascita field. The --jsonArray parameter does not fix the errors. Question: is It something wrong with the json file or is It something wrong with ISODate data type and my version of mongodb? (it is not the mongodb-org software installed).
On Microsoft Windows 7
with a later mongodb version it seems all to work just fine:
So now I am going back home, remove mongodb installed, install later version and update here.
It turns the installation was not successfully ended. I installed the same mongodb version one time again.
As soon as the installation ended, I was able to run successfully the mongoimport command with the ISODate objects inside the json input file.

Mercurial track changes of a line

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.