Show log of only branches and merges - mercurial

In Mercurial, is it possible to create a repository log which only only shows branch and merge history? i.e., any other commits would be excluded?
If possible, this would present a higher-level view of project history which may be useful in some circumstances (such as training others).
The ideal would be to have a graphical log output of this (such as in TortoiseHg).

Revsets are so powerful. May be showing the merge() changesets or its parents.
$ hg log -G -T "{rev} {branch}" -r "merge() or merge()^1 or merge()^2"
Gives something like
o 296 stable
|\
| o 295 test
| |\
| | # 294 default
| | |
o | | 292 stable
| | |
o | | 290 stable
|\| |
| o | 289 test
| |\|
| | o 288 default
| | |
| o | 287 test
| |\|
| | o 286 default
| | |
| o | 284 test
| |\|
| | o 283 default
...
o | 30 stable
|\|
o | 29 stable
| |
| o 28 default
| |
| o 27 default
|/|
o | 26 stable
|/
o 4 default
|
The only commit changesets are hidden.

repository log which only only shows branch and merge history?
Yes. hg help revsets
The ideal would be to have a graphical log output of this
hg log -G -r "REVSET"

Related

Summing data in google sheets based on multiple columns

I have an export from a time sheet program of hours worked on projects in the following format.
Existing Data
Resource | Project | Subtask | Hours
Alice | Artemis | Dev | 10
Alice | Artemis | Dev | 20
Alice | Artemis | Dev | 30
Alice | Boreas | Dev | 10
Beth | Artemis | Test | 10
Beth | Boreas | Test | 20
Beth | Boreas | Test | 30
Beth | Boreas | Test | 10
Claire | Boreas | Dev | 10
Claire | Boreas | Dev | 20
Claire | Boreas | Dev | 30
Claire | Boreas | Dev | 10
Can anyone tell me how to generate the following summary/ aggregation report? I assume the answer will involve Query, but I haven't been able to get the summing of the hours to work, and I wonder if the answer will require a combination of query and other functions.
Desired Output
Project | Subtask | Resource | Total Hours
Artemis | Dev | Alice | 60
Artemis | Test | Beth | 10
Boreas | Dev | Alice | 10
Boreas | Dev | Claire | 70
Boreas | Test | Beth | 60
Thanks in advance for any suggestions that move me forward.
Looks similar to https://webapps.stackexchange.com/questions/100274/google-sheets-query-group-by-multiple
Does something like this work?:
QUERY(ARRAYFORMULA(IMPORTRANGE(
<spreadsheet_url>,
<range>")),
"Select Project, Subtask, Resource, sum(Hours)
group by Project, Subtask, Resource label sum(Hours) 'Total Hours'")

mysql weirdly formatting output

mysql is weirdly formatting my output even though the table isnt overflowing with data in any way (only 30-4 rows, and 4 columns).
Is there something I can do to adjust this?
mysql> select id, city, state, zip from location;
+----+----------------+-------+-------+
| id | city | state | zip |
+----+----------------+-------+-------+
| 97227 |and | OR
| 95814 |mento | CA
| 94607 |nd | CA
| 90245 |gundo | CA
| 90015 |ngeles | CA
| 85004 |ix | AZ
| 84101 |Lake City | UT
| 80204 |r | CO
| 78219 |ntonio | TX
| 77002 |on | TX
| 75219 |s | TX
| 73102 |oma City | OK
| 70113 |rleans | LA
| 60612 |go | IL
| 55403 |apolis | MN
| 53203 |ukee | WI
| 48326 |n Hills | MI
| 46204 |napolis | IN
| 44115 |land | OH
| 38103 |is | TN
| 33132 | | FL
| 32801 |do | FL
| 30303 |ta | GA
| 28202 |otte | NC
| 20004 |ngton | DC
| 19148 |delphia | PA
| 11217 |lyn | NY
| 10121 |ork | NY
| 29 | Boston | MA | 2114 |
+----+----------------+-------+-------+
29 rows in set (0.00 sec)
Somehow you got carriage returns at the end of most of the state values. You can remove them with:
UPDATE location SET state = TRIM(TRAILING '\r' FROM state);
And you should investigate the code you use to add rows to this table, to see why it's leaving those characters in the data. You're probably using a file that was created on Windows and loading it into a program that runs on Unix. You can use the dos2unix command on Linux to fix all the newlines in a file. Or you can fix the program so it removes extraneous carriage return characters.

How to get aggregated list of logged error codes from MySQL database?

So, I have this table full of 10-minute data. In one of the columns is a system code, showing zeros for when there's no problem and any other number when there is a problem.
I'd like to generate a list of all error codes. Easy enough, of course, but here's the thing. I want to aggregate the data. Let's say that on January 28th at 17:10 an error occured which persisted until 17:40. Every seperate 10-minute entry between these two dates/times shows the same error code. How do I get a list which simply shows [errorcode][startdate][enddate] for each seperate occurence?
I've been looking all over the place, but haven't found a solution yet.
Update: Table structure
+-------+------------------+------+-------+--------+
| Id | Time | Wind | Power | System |
+-------+------------------+------+-------+--------+
| 44461 | 2012-01-28 16:50 | 0.3 | 0.0 | 0 |
| 44461 | 2012-01-28 17:00 | 3.3 | 10.1 | 0 |
| 44461 | 2012-01-28 17:10 | 4.4 | 53.7 | 275 |
| 44461 | 2012-01-28 17:20 | 4.7 | -4.3 | 275 |
| 44461 | 2012-01-28 17:30 | 4.9 | -3.9 | 275 |
| 44461 | 2012-01-28 17:40 | 5.2 | -3.2 | 275 |
| 44461 | 2012-01-28 17:50 | 4.9 | 62.6 | 0 |
+-------+------------------+------+-------+--------+

How to import aws public dataset into mysql instance?

I'm trying to use a public dataset in Amazon AWS, called Twilio/Wigle.net Street Vector Data Set. This dataset contains data of US street names and address ranges. Its size is about 10 GiB. When we take a look in linux, it looks like the following :
ubuntu#ip-172-31-xxx-xxx:/data-us-street$ pwd
/data-us-street
ubuntu#ip-172-31-xxx-xxx:/data-us-street$ ll
total 20576
drwxr-xr-x 6 27 sudo 4096 May 19 2009 ./
drwxr-xr-x 23 root root 4096 Apr 20 18:10 ../
-rw-r--r-- 1 root root 8339 May 19 2009 README
drwx------ 2 27 sudo 4096 Mar 18 2009 addresses/
-rw-rw---- 1 27 sudo 5242880 Mar 18 2009 ib_logfile0
-rw-rw---- 1 27 sudo 5242880 Mar 8 2009 ib_logfile1
-rw-rw---- 1 27 sudo 10485760 Mar 18 2009 ibdata1
drwx------ 2 27 sudo 16384 Mar 8 2009 lost+found/
drwx------ 2 27 sudo 4096 Mar 8 2009 mysql/
-rw-rw---- 1 27 sudo 117 Mar 18 2009 mysql-bin.000001
-rw-rw---- 1 27 sudo 19 Mar 18 2009 mysql-bin.index
drwx------ 2 27 sudo 4096 Mar 8 2009 test/
In order to use its data, I want to link it to a MySQL database in the same host. Can somebody tell me how to do it ?
What I've tried
I've tried to overwrite the mysql storage directory datadir located at /etc/mysql/my.cnf with the following change :
#datadir = /var/lib/mysql
datadir = /data-us-street
I stopped the server, changed to value then restarted the MySQL server. However, it doesn't work.
README
/*
Copyright (c) 2009 Twilio, Inc.
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
*/
1. The Twilio/Wigle.net public address dataset
This public dataset contains the street data for the U.S., based on
the geodata published by the U.S. Census Bureau's TIGER project.
We have reformated the data from GIS friendly shapefiles to a more
generally accessible MySQL database.
This dataset covers all the streets, roads, and highways in the U.S.
These streets are represented as "polylines" which are shapes made up
of individual line segments. Each polyline has its own unique ID,
and each segment that makes up the polyline has a sequence number.
The combination of this ID and sequence number is the primary key of
the address table. Each row in the database represents one of these
line segments.
2. Description of Columns
+-------------+------------+------+-----+------------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------+------------+------+-----+------------+-------+
| id | char(10) | NO | PRI | | |
| seq | char(3) | NO | PRI | | |
| name | char(30) | YES | MUL | NULL | |
| prefix | char(2) | YES | MUL | NULL | |
| type | char(4) | YES | | NULL | |
| startlat | float(12,8)| NO | | 0.00000000 | |
| startlong | float(12,8)| NO | | 0.00000000 | |
| endlat | float(12,8)| NO | | 0.00000000 | |
| endlong | float(12,8)| NO | | 0.00000000 | |
| leftzip | int(5) | YES | MUL | NULL | |
| rightzip | int(5) | YES | MUL | NULL | |
| leftaddr1 | char(11) | YES | | NULL | |
| leftaddr2 | char(11) | YES | | NULL | |
| rightaddr1 | char(11) | YES | | NULL | |
| rightaddr2 | char(11) | YES | | NULL | |
| name_dtmf | char(30) | YES | | NULL | |
| prefix_dtmf | char(2) | YES | | NULL | |
+-------------+------------+------+-----+------------+-------+
id - this is the unique ID of a street, road, or highway polyline,
according to US census blocks
seq - this is the sequence number of this segment in the polyline,
used to correlate 2 segments of the same street within a US
census block
name - the name of this street, road, or highway. example: Main
prefix - the prefix of the street name. examples: N,S,E,W
type - the suffix of the street name. examples: Blvd, St, Rd
startlat/startlong - the lat/long pair of this segments the starting
point
endlat/endlong - the lat/long pair of this segments the ending point
leftzip/rightzip - the zipcode of the addresses on the corresponding
side of the street
leftaddr1/leftaddr2/rightaddr1/rightaddr2 - the starting and ending
addresses
numbers for each side of the street
name_dtmf/prefix_dtmf/type_dtmf - the name, prefix and type columns,
represented
as DTMF encoded numbers. For example, (A,B,C) = 2, (D,E,F) = 3,
etc.
Useful for telephony applications.
3. Example Segment
--------------------------------------------------------
id: 111710515
seq: 0
name: Main
prefix:
type: St
startlat: 41.49493408
startlong: -87.70324707
endlat: 41.49483490
endlong: -87.70324707
leftzip: 60466
rightzip: 60443
leftaddr1: 21801
leftaddr2: 21805
rightaddr1: 21800
rightaddr2: 21804
name_dtmf: 6246
prefix_dtmf:
--------------------------------------------------------
Name: Main St.
Left Zip: 60466
21801 21805
X------------------------------------>
21800 21804
Right Zip: 60443
4. Common Queries
a. Find the street segment record for 30 Rockefeller Plaza, NY, NY,
10020
SELECT * FROM address WHERE leftzip=10020 AND name LIKE 'Rockefeller'
AND 30 BETWEEN leftaddr1 AND leftaddr2
UNION
SELECT * FROM address WHERE rightzip=10020 AND name LIKE
'Rockefeller' AND 30 BETWEEN rightaddr1 AND rightaddr2
--------------------------------------------------------
id: 59657155
seq: 0
name: Rockefeller
prefix:
type: Plz
startlat: 40.7585
startlong: -73.979
endlat: 40.7592
endlong: -73.9786
leftzip: 10020
rightzip: 10020
leftaddr1: 22
leftaddr2: 38
rightaddr1: 21
rightaddr2: 39
name_dtmf: 7625335537
prefix_dtmf:
--------------------------------------------------------
b. Find all the street names within a zipcode.
SELECT DISTINCT prefix, name, type FROM address WHERE leftzip=10009
OR rightzip = 10009
+--------+----------+------+
| prefix | name | type |
+--------+----------+------+
| | 1st | Ave |
| | Avenue A | |
| E | 13th | St |
| E | 14th | St |
| E | 12th | St |
| E | 11th | St |
| E | 10th | St |
| E | 2nd | St |
| E | 3rd | St |
| E | 4th | St |
| E | 6th | St |
| E | 7th | St |
| | St Marks | Pl |
| E | 9th | St |
| | Avenue B | |
| E | 5th | St |
| | Avenue C | |
| E | 20th | St |
| E | 15th | St |
| E | 16th | St |
| E | 8th | St |
| | Avenue D | |
| | Szold | Pl |
+--------+----------+------+
c. Streets starting with F in a zipcode
SELECT DISTINCT prefix, name, type from address WHERE leftzip = 94117
AND name LIKE 'F%'
UNION
SELECT DISTINCT prefix, name, type from address WHERE rightzip =
94117 AND name LIKE 'F%'
+--------+------------+------+
| prefix | name | type |
+--------+------------+------+
| | Fulton | St |
| | Fell | St |
| | Frederick | St |
| | Farnsworth | Ln |
| | Fillmore | St |
| | Friendship | Ct |
+--------+------------+------+
d. Streets starting with "FRE" as DTMF digits in a zipcode:
SELECT DISTINCT prefix, name, type from address WHERE leftzip = 94117
AND name_dtmf LIKE '373%'
UNION
SELECT DISTINCT prefix, name, type from address WHERE rightzip =
94117 AND name_dtmf LIKE '373%'
+--------+------------+------+
| prefix | name | type |
+--------+------------+------+
| | Fulton | St |
| | Fell | St |
| | Frederick | St |
| | Farnsworth | Ln |
| | Fillmore | St |
| | Friendship | Ct |
+--------+------------+------+
Every sub-folder under the root folder /data-us-street represents a database. So if I want to use database addresses, I need to use folder ./addresses:
Copy the target database folder into the data directory of the current MySQL Database Server instance, e.g. /var/lib/mysql
$ cp -r /data-us-street/addresses /var/lib/mysql/addresses
Change the folder owner recursively
$ chown mysql:mysql /var/lib/mysql/addresses/*
Use database addresses and enjoy !

Phases: How to specify as range endpoint the first non-obsolete predecessor of an obsolete changeset?

Problem:
When using the 'evolve' extension for Mercurial some changesets are marked obsolete and are therefore hidden for example to the 'log' command, like this:
$ hg log -11:
abort: hidden revision '-11'!
(use --hidden to access hidden revisions)
$ hg log -12: -T '{rev}'
o 27916
|
| o 27915
| |\
| o | 27914
| | |
| o | 27913
| |/
| | o 27912
| | |
| | o 27911
| | |\
| | o | 27910
| | | |
| | o | 27909
| | | |
| | | | # 27908
| | | | |
| | | | o 27905
| | | | |
Question:
Is there a way to specify a range endpoint to represent either a non-hidden changeset or, if the given changeset is hidden (like '-11'), the preceding non-hidden ancestor (in this example '-12')? I looked at the 'revsets' documentation but failed to find a combination which worked.
The answer to your question lies in the proper use of revsets. Checkout hg help revsets for more indepth information.
In this case this should work:
hg glog -r"last(ancestors(-11) and not hidden())::-11" --hidden
It will list all changesets from -11 to the first non-hidden ancestor of -11 (including those two).