1. 3

    you can get free dns services (including just-slave) from hurricane electric: https://dns.he.net/

    1. 3

      Also, Cloudflare provides DNS in their free plan. Though it doesn’t cover all record types, it’s still pretty good.

      1. 2

        That’s very interesting (and quite rare), thanks! How did you hear about it?

        1. 2

          i run a he ipv6 tunnel for some years now, i guess it was recommended by a friend back then. i can only recommend the free hurricane electric services, never had any problems. they even send me a new t-shirt when my free-ipv6-certification-sage-t-shirt got lost in international mail :)

      1. 3

        Grab is the biggest startup in the history of Southeast Asia. Grab is fighting the most important battle in the world today, on the biggest stage. I am typing this on a plane coming back from Jakarta, where I just witnessed history in the making.

        Grab is the new blockchain

        1. 2

          In what other languages would it be possible?

          I guess everything with properties (functions disguised as fields) so D, C#, etc.

          Afaik not with C, C++, or Java.

          1. 26
            #define a (++i)
            int i = 0;
            
            if (a == 1 && a == 2 && a == 3)
                ....
            
            1. 1

              Isn’t that undefined behavior? Or is && a sequence point?

              1. 3

                && and || are sequence points. The right expression may never happen depending on the result of the left, so it would make things interesting if they weren’t.

            2. 10

              This is very easy to do in C++.

              1. 5

                You can also do it with Haskell.

                1. 3

                  Doable with Java (override the equals method), and as an extension, with Clojure too:

                  (deftype Anything []
                    Object
                    (equals [a b] true))
                  
                  (let [a (Anything.)]
                    (when (and (= a 1) (= a 2) (= a 3))
                      (println "Hello world!")))
                  

                  Try it!

                  Or, inspired by @zge above:

                  (let [== (fn [& _] true)
                        a 1]
                    (and (== a 1) (== a 2) (== a 3)))
                  
                  1. 3

                    Sort of. In Java, == doesn’t call the equals method, it just does a comparison for identity. So

                     a.equals(1) && a.equals(2) && a.equals(3); 
                    

                    can be true, but never

                     a == 1 && a == 2 && a == 3;
                    
                  2. 3

                    perl can do it very simply

                    my $i = 0;
                    sub a {
                    	return ++$i;
                    }
                    
                    if (a == 1 && a == 2 && a == 3) {
                    	print("true\n");
                    }
                    
                    1. 2

                      Here is a C# version.

                      using System;
                      
                      namespace ContrivedExample
                      {
                          public sealed class Miscreant
                          {
                              public static implicit operator Miscreant(int i) => new Miscreant();
                      
                              public static bool operator ==(Miscreant left, Miscreant right) => true;
                      
                              public static bool operator !=(Miscreant left, Miscreant right) => false;
                          }
                      
                          internal static class Program
                          {
                              private static void Main(string[] args)
                              {
                                  var a = new Miscreant();
                                  bool broken = a == 1 && a == 2 && a == 3;
                                  Console.WriteLine(broken);
                              }
                          }
                      }
                      
                      1. 2

                        One of the ‘tricks’ where all a’s are different Unicode characters is possible with Python and Ruby. Probably in Golang too.

                        1. 7

                          In python, you can simply create class with __eq__ method and do whatever you want.

                          1. 4

                            Likewise in ruby, trivial to implement

                            a = Class.new do
                              def ==(*)
                                true
                              end
                            end.new
                            
                            a == 1 # => true
                            a == 2 # => true
                            a == 3 # => true
                            
                        2. 2

                          In Scheme you could either take the lazy route and do (note the invariance of the order or ammount of the operations):

                          (let ((= (lambda (a b) #t))
                                 (a 1))
                            (if (or (= 1 a) (= 2 a) (= 3 a))
                                "take that Aristotle!"))
                          

                          Or be more creative, and say

                          (let ((= (lambda (x _) (or (map (lambda (n) (= x n)) '(1 2 3)))))
                                  (a 1))
                              (if (or (= 1 a) (= 2 a) (= 3 a))
                                  "take that Aristotle!"))
                          

                          if you would want = to only mean “is equal to one, two or three”, instead of everything is “everything is equal”, of course only within this let block. The same could also be done with eq?, obviously.

                          1. 1

                            Here is a Swift version that uses side effects in the definition of the == operator.

                            import Foundation
                            
                            internal final class Miscreant {
                                private var value = 0
                                public static func ==(lhs: Miscreant, rhs: Int) -> Bool {
                                    lhs.value += 1
                                    return lhs.value == rhs
                                }
                            }
                            
                            let a = Miscreant()
                            print(a == 1 && a == 2 && a == 3)
                            
                          1. 6

                            can’t edit OP, but now I have GaS - GG Flip as a Service. I have incorporated a company, now looking for investors.

                            1. 6

                              What am I looking at?

                                1. 3

                                  We don’t discuss all of our security processes and technologies in specific detail for what should be obvious reasons

                                  isn’t that worrisome?

                                  1. 5

                                    When it’s related to spam mitigation it’s not unusual.

                                  2. 2

                                    That’s a little worrisome. They built an auto nuker, but didn’t think about what next? Whether it’s a false positive or not, “what if it’s republished?” should be part of the checklist. What if it really were malicious? I just keep retrying until I find a version that sticks.

                                  3. 4

                                    The left-pad thing happened again.

                                    1. 2

                                      Somebody left padded the safeguards meant to prevent left padding? “no, no, we totally fixed it by adding a ‘are you sure you want to fuck everybody?’ confirmation to the delete command.”

                                      1. 1

                                        Has anyone written up the impact this time around?

                                    1. 24

                                      It’s important to note that this article refers to the Docker company being dead as opposed to the software. It would be quite the overstatement to say that the software is dead given how many people use Docker for deployment, CI and development.

                                      Personally, I’m not worried. Even if the Docker company went under there is too much momentum behind the software. If the company stopped supporting the software, there’d be a hard-fork, a new Dockerhub and things would go on.

                                      1. 4

                                        It’s important to note that this article refers to the Docker company being dead as opposed to the software.

                                        The blog title is Docker, Inc is Dead, which is accurate. However, I think, OP did not do same while submitting on Lobsters. I requested a title change suggestion.

                                        1. 9

                                          I’m fairly certain that the article’s title also was different a while ago.

                                          1. 2

                                            The blog post’s title definitely was just “Docker is Dead” when this was first submitted, I checked when I was debating suggesting a different title here earlier.

                                        2. 2

                                          Yeah. Stuff like rubygems.org lives on sponsorship from many companies, rather than a backing company. It’ll be fine. I can’t see how Docker the company matters anymore either.

                                          1. 1

                                            There’s no mention of what will happen with all the OSS code and docker hub. I realize this isn’t an official press release, but I wish it was still mentioned. Do the current Docker owners plan on moving all their public/oss assets into a non-profit like Mozilla and keep it community driven? Do various industries plan on funding it as an open source initiative? What does this mean for Open Container and what working group will agree on the future of docker/containers?

                                          1. 1

                                            Max also talked about this a year ago on the changelog: https://changelog.com/podcast/232 .

                                            1. 2
                                            1. 2

                                              Consider making a donation to Django

                                              and also here are top recommendations by GiveWell

                                              1. 3

                                                Not me, but here is what Bill Gates recommends for this year - Books I read this year

                                                1. 4

                                                  It’s not really a good idea to repost rumor mongering and she-said/she-said drama, especially when no other sources were linked.

                                                  I’m worried that this is the sort of submission that just makes a bunch of angry comments by people who want to argue culture war or something else without useful perspective on the situation.

                                                  1. 3

                                                    It’s not really a good idea to repost rumor mongering and she-said/she-said drama, especially when no other sources were linked.

                                                    This is inherent to the nature of she-said/she-said posts, when such stories break out I doubt if you can have trustworthy sources unless there is judiciary involved with a verdict. Or else, how do you judge a source is valid or a person is not lying? There is no way.

                                                    Case in point, when Susan Fowler’s post came out, which is also of same nature, had 150+ upvotes on Lobste.rs. Going by average upvotes a post receives on Lobste.rs, 150 is a lot.

                                                    1. 1

                                                      I didn’t upvote that story, for the same reasons.

                                                    2. 0

                                                      I agree. No sources on a loaded topic. Probably not lobsters worthy.

                                                      1. 6

                                                        If you read the whole thread from start, it gives you an entirely new perspective: 1, 2, 3, 4 and the Linus’ reply - 5

                                                        1. 2

                                                          Later, he explains why he reacted so strongly in his earlier reply, and apologises:

                                                          https://lkml.org/lkml/2017/11/21/315

                                                        1. 12

                                                          Try http://paperswelove.org.

                                                          | Papers We Love is a repository of academic computer science papers and a community who loves reading them.

                                                          It’s a git repo of classic CS papers and a website for people who want to get together to discuss them. Some of the papers are easy, some hard, but a treasure trove to work your way through.

                                                          1. 6

                                                            Thanks for the PWL shout-out. PWL was started as a reading group within our old company, and we began with Out of the Tarpit and Communicating Sequential Processes. Those were the first papers I read, and I found them widely applicable, interesting, and approachable.

                                                            1. 3

                                                              In the same spirit, I really enjoy Fermat’s Library. I don’t really read the annotated versions most of the times, as the website is set up in a way that makes it annoying for me (which is a shame, the comments are normally pretty great), but use it mostly as a feed of interesting papers to read on different areas.

                                                              1. 1

                                                                It’s a huge repo, any guidelines to find the ones which are easy/beginner friendly?

                                                                1. 6

                                                                  The section on design is a good start, especially “No Silver Bullet” (NSB) and “Out of the Tarpit” mentioned above.

                                                                  Fred Brooks, who wrote NSB, also wrote another classic before that called “The Mythical Man Month” which is sold on Amazon as a collection of papers, including NSB.

                                                                  A Mathematical Theory of Communication” by Claude Shannon is the foundational work in information theory.

                                                                  Reflections on Trusting Trust” is a great read and eye opening as an intro to security.

                                                                  The Unix Time-Sharing System” by Dennis Ritchie and Ken Thompson is the classic intro to Unix.

                                                                  In addition to these and others from PWL, I’d also add Dijkstra’s paper “Go To Statement Considered Harmful”. Whether you agree or disagree, it’s the seminal paper on structured programming.

                                                                  I’d start with those, follow interesting footnotes and references to see where they lead you.

                                                                1. 2

                                                                  Label: P0-dropeverything

                                                                  Oh, everything’s dropped alright…

                                                                1. 60

                                                                  I’m pretty uncomfortable with calling software “sexy”.

                                                                  1. 27

                                                                    Agreed. And going to a website promoting ostensibly professional software only to see “sexy” in large type multiple times just doesn’t feel work appropriate.

                                                                    “the little sweet and sexy” is just not a phrase you should be using to describe software. It’s off-putting to people, and it’s generally (at least in pop culture) used by leachers old men.This feels like yet another example of how tone deaf men in tech can be.

                                                                    1. -5

                                                                      Glad to you took the time to insult and signal how much better you are than those leacher, tone deaf old men who wrote some free software for you. It’s really a great way to earn friends and show them the errors of their ways by shaming people publicly. /s

                                                                      p.s. I agree with the sentiment, and hwayne’s comment is far more appropriate than some of the others I have seen. He expresses his own opinion, not theoretical opinions of others, and doesn’t shame anyone.

                                                                      p.p.s The funny thing Is rereading my own comment, I see I am not even following my own advice! A better comment would be something like:

                                                                      I do not agree with calling potentially well meaning people “tone deaf”.

                                                                    2. 5

                                                                      Same for me, but that’s probably the sign of times. I have also the same feeling when people say that they love this company or that software.

                                                                      Of course when old established projects use such a lingo it may sound like when old people say something in teenage slang. It will feel off for teenagers and alien to other old people. Sort of uncanny valley?

                                                                      1. 3

                                                                        At some point you are reading way too far into things… It just means ‘stronger than like’ in that context.

                                                                        I love my pet dogs. I love good food. I love good software.

                                                                        1. 5

                                                                          It may be because I’m not a native English speaker. In my language love is mostly reserved to the top emotion. Then if you love something (your work or music genere) it means that it can literally compete with the feeling you have to e.g. your spouse. I guess it’s something that I can’t get over. Especially regarding purely profit motivated endeavours.

                                                                          1. 4

                                                                            Almost certainly a native/non-native speaker thing. In American English at least, ‘love’ is a pretty tame word that gets thrown around for everything. There really isn’t a specific word distinct for, e.g., the feeling one feels about their spouse; about their kids; etc. Usually ‘love’ is used there too, and context determines the level of effect.

                                                                            Occasionally you might see modifiers like, “brotherly love”, “fatherly love”, “familial love”, etc. That’s not super common though, mostly just context to delineate the quality of the usage.

                                                                            What is your native language? I know Greek has a few different words for different classes of ‘love’, and I imagine it’s not super uncommon, but I’m always curious about language related topics and the different quirks various languages have.

                                                                            1. 3

                                                                              I’m Polish. We say something like “brotherly love” or “fatherly love”. One can love their work, hobby and certainly their pet. But when someone says that he loves food or a thing it sound strange. “Like” is “lubić”. “Love” is “kochać”. “Love” in context of things would be more commonly translated to “uwielbiać”. It literally means “worship”, but in this context it is really more like “love” used as “stronger than like”. So maybe it is more crazy then in English.

                                                                              Love as a verb is “kochać”. But love as a noun is “miłość”. So “kochać” means that you feel “miłość” to somebody.

                                                                              I heard people from more pop part of younger generation saying such things, but it sounds for me like a literal translation from English. I heard it in movies and especially children movies. It almost always sounded off to me, but next generation is learning this foreign use. So I guess I’m doomed thanks to globalization ;).

                                                                              1. 1

                                                                                I’m also Polish and to be honest I find nothing strange in usage of “love” in context of “food or a thing” (both in Polish and in English). Considering that it seems from your linkedin profile that I’m older (32) than you I think your generalizations about younger generation is wrong :)

                                                                      2. 3

                                                                        Yes. Also: laptops, companies, fields of study, consumer electronics, genres of literature, fonts, cooking techniques…

                                                                        Unless you are literally indicating sexual attractiveness, please use a word such as “exciting”, “sleek”, or “fashionable”.

                                                                        1. 2

                                                                          I don’t think I have a problem with the sexy part, I have a problem with the screenshots make it not even look all that great. Those fonts are terrible. There’s nothing in the feature list that really even makes me want to try it out over the editors/IDEs I currently use.

                                                                          1. 3

                                                                            I filed an issue. Please consider +1

                                                                            https://github.com/geany/geany/issues/1672

                                                                            1. 10

                                                                              Is not “sexy” a gender neutral word, that can be used about both genders?

                                                                              1. 14

                                                                                It’s not about whether it’s gender neutral. It’s just kinda weird.

                                                                                1. 6

                                                                                  Agree, but linked issue mentions women as if word “sexy” offends women more than men.

                                                                                  1. 9

                                                                                    Yes, sexy is gender neutral. What makes it potentially offensive to women is the association with exploitation and objectification.

                                                                                    The word itself isn’t offensive. I can say that I find my wife to be drop dead sexy, but that’s because in that context it’s entirely appropriate.

                                                                                    1. 4

                                                                                      I completely agree that sexy in context of software sounds strange at best. I just don’t think that mentioning one particular gender in that issue was needed.

                                                                                      1. -2

                                                                                        Stop taking offense on behalf of others.

                                                                                        1. 10

                                                                                          Fascinating that you see it that way. When there is a gigantic groundswell of people saying “your behavior makes me uncomfortable” I try to change that behavior.

                                                                                          I for one value women in tech. I find their presence in my day to day working life improves my productivity and the productivity of the teams I work on, as does a diversity of backgrounds, opinions and characteristics.

                                                                                          So, for me this isn’t about offense, it’s about trying to make the industry I care deeply about a more welcoming place for a group of people I also care deeply about.

                                                                                          1. 10

                                                                                            Folks can play dumb about “sexy” alone, but when you address the complete phrase, “little, sweet, and sexy,” someone’s gotta be pretending to be reeeal oblivious to show up and say oh that’s neutral we’re not talking about software like we wanna talk about women.

                                                                                            Anyway keep speaking up, because yeah it’s not “taking offense on behalf of others” its paying attention to them and having consideration without them having to speak every time. And I sure as heck don’t like to wade directly into this kind of talk on lobsters very often, it’s rarely worth it.

                                                                                            1. 2

                                                                                              Thanks. I think that’s why it’s important for people in privileged situations like myself to at least try and raise awareness. I don’t let the negative comments get to me - I was donning my asbestos underwear and wading into email/USENET threads before most of these people were born :)

                                                                                              1. 1

                                                                                                I can’t imagine people talking about women that way. Would be super creepy to use a phrase like “sweet and sexy” about a person instead of a thing…

                                                                                                1. -1

                                                                                                  Maybe you are (or someone reading this is) not aware of the counter argument so I thought I’d share: the implication in your comment is that sex necessarily exploits women, which is false. The idea that sex necessarily exploits women reinforces the belief that we must protect women from sex as we do children. This is a defining aspect of anti-sex, Third Wave feminism, which I believe runs counter to the feminist goals of dismantaling fascist and patriarchal structures in society.

                                                                                                2. 6

                                                                                                  I am very rarely seeing a groundswell of people saying “Your behavior makes me uncomfortable”.

                                                                                                  What I actually see is people saying “I assume your behavior is making somebody else uncomfortable, and I am taking the credit for ‘fixing’ you”. I far prefer the original comment from hwayne where he was talking about his own opinions, rather than imagining those of other people.

                                                                                                  1. 6

                                                                                                    My upvotes usually mean “you speak for me also”. It’s quite a time saver. :) So, to clarify, I myself personally was made uncomfortable by someone describing software as “sweet and sexy”. So much so that I only skimmed the first page or so and closed the tab.

                                                                                                    I assume they had good intentions. If I were the author, I’d work a bit more to come up with some way to express my excitement at having written something cool, without sounding creepy.

                                                                                                    1. 4

                                                                                                      And I’d like to be very clear, I don’t disagree with the argument, I disagree with some of the methods used to enforce them.

                                                                                                    2. 3

                                                                                                      I for one value women in tech. I find their presence in my day to day working life improves my productivity and the productivity of the teams I work on, as does a diversity of backgrounds, opinions and characteristics.

                                                                                                      Non-native English speaker here. How does the term sexy offend only women and make them unwelcome to OSS? I mean, I understand the top comment (by hwayne) here saying how it would make someone uncomfortable, but why I don’t understand why it is only limited to women.

                                                                                                      1. 5
                                                                                                        Quoting a woman who’s a friend of mine from another context, unattributed at her request:

                                                                                                        The word “sexy” when used to mean that something is sexually attractive, is what it is. You may or may not be expressing something offensive when you use it. The word “sexy” when used to describe something that is not sexual - a car, an algorithm, a user interface - still evokes the idea of sex. It implies that you should feel sexually “turned on” by it, even if it is not literally a thing with which you would have sex. Given the cultural and historical context of our times, a professional environment where people are expected to feel sexually “turned on” by things, or where the idea of sex is constantly referred to when it is not technically relevant, is not an environment where many women will assume they are respected or even safe. You personally might go ahead and assume you are safe and respected. Many women won’t. This reduces the pool of women who are interested in applying for jobs at your company, or interested in staying once they have experienced it for awhile. The people who create the culture of a company either care about that, or they don’t.

                                                                                                  2. -1

                                                                                                    But you are the one drawing associating between “sex” and “exploitation” and “women”.

                                                                                            2. 7

                                                                                              For those who are about to read: note that geany.sexy is not managed by the maintainers of the Geany IDE, so the issue didn’t end up going anywhere.

                                                                                              1. 7

                                                                                                This seems like a silly thing to even care about. It’s like the whole master/slave IDE cable debate. Seriously, it doesn’t need to be a big deal. It’s not even the editors official site. There are more important things to spend time on.

                                                                                              2. -2

                                                                                                Are you uncomfortable with sexuality in general?

                                                                                              1. 4

                                                                                                [self plug] I wrote some examples to show how to handle errors in gRPC as docs aren’t clear - gRPC Errors

                                                                                                1. 4

                                                                                                  I’m amazed that this hasn’t been submitted before!

                                                                                                  1. 1

                                                                                                    yeah, isn’t it a decade old?

                                                                                                    1. 1

                                                                                                      Protobuf is. gRPC is more recent. Well, at least the publicly released version.

                                                                                                    2. 1

                                                                                                      It has been submitted before

                                                                                                      1. 2

                                                                                                        Ha! Apparently by me, even!

                                                                                                        1. 1

                                                                                                          Ahh, yeah, you submitted the /docs link, while I just used the base URL, so the check for duplicate link didn’t work. Sorry about that!

                                                                                                    1. 10

                                                                                                      Am I allowed to say this is just building a basic qt application and has nothing to do with the specifics of pty handling?

                                                                                                      1. 5

                                                                                                        I’d just like to say that Qt isn’t very minimal (too soon?).

                                                                                                        I must say I did learn something in this article – namely, that Qt has a terminal widget that I could use to easily bootstrap a new application that includes a terminal emulator. I pretty much assumed that was the case, already, without knowing for sure. But what I really wanted to see is the way in which it was “scriptable.” I was hoping for some creativity – maybe implementing tmux style stuff in the Qt frames, or something. I am disappoint.

                                                                                                        1. 1

                                                                                                          Am I allowed to say …

                                                                                                          You are! Why such question in the first place?

                                                                                                          And I do agree that this article kinda overpromises with the title and not much of the content

                                                                                                          1. 2

                                                                                                            I think @tedu is providing a commentary on the recent moderation debacle (is it a debacle? I don’t know) that’s spawned lots of debate in the Lobste.rs community. I’ll let you investigate rather than link.

                                                                                                        1. 4

                                                                                                          Should the link be to a playlist rather than a specific talk?

                                                                                                          1. 1

                                                                                                            you are right. I don’t know how I messed up the submission. Now I can’t delete or edit it. How do I bring this to moderators attention?

                                                                                                            1. 1

                                                                                                              I’ve fixed the link to point to the playlist.

                                                                                                          1. 8
                                                                                                            • git push --force-with-lease :: probably my favorite example of git doing the “right” thing the wrong way.
                                                                                                            • git reflog :: for sleuthing after a horrifying rebase mistake
                                                                                                            • M-x magit-status (or equivalent staging tools like git add -p) :: really make things feel comfortable.
                                                                                                            • cp -a :: I often forget these are just files. Don’t forget! If your repo is in a delicate state, just copy the whole damned thing, and try it out.
                                                                                                            1. 1

                                                                                                              probably my favorite example of git doing the “right” thing the wrong way.

                                                                                                              elaborate why?

                                                                                                            1. 18

                                                                                                              Because there is nothing I love more than comparing Git and Mercurial using specific examples, here’s a great big piece of text discussing the design choices that went into these Git commands, and their Mercurial counterparts. Enjoy ;-)

                                                                                                              For those who don’t want to read the whole thing, the paragraphs on “See which branches you recently worked on” and “Show changed words instead of lines” probably have the most interesting tidbits.

                                                                                                              Leaderboards

                                                                                                              Enable the bundled churn extension, and use hg churn, with --changesets to count commits instead of lines touched; -t '{author|email}' to group changesets by the output of a template expression, in this case the committer’s e-mail address; and -r to limit to a subset of revisions.

                                                                                                              # hgrc:
                                                                                                              #   [extensions]
                                                                                                              #   churn =
                                                                                                              hg churn --changesets -t '{author|email}' -r 'date("2016-01-01 to 2016-12-01")'
                                                                                                              
                                                                                                              # git shortlog -sn --since='10 weeks' --until='2 weeks'
                                                                                                              

                                                                                                              Something I like about Git’s design: that you can type e.g. 2 weeks and it will interpret it as the date 2 weeks ago. Mercurial has date(-10) for ‘the date range from 10 days ago to now`, but it’s not the same …. Something I like about Mercurial’s design: that grouping and tallying changes has a separate command, rather than being a ‘summary’ option on top of a ‘log’ variant that groups commits (but is called ‘shortlog’ rather than ‘grouplog’)

                                                                                                              Praise instead of blame

                                                                                                              Defining an alias so you can praise instead of blame: I very much agree, and have indeed got a similar alias in my .hgrc. (In fact, I could have sworn git praise is defined out-of-the-box. Seems it isn’t. Was that SVN, then?)

                                                                                                              Something I like about Git’s design: that it lets you set options from the command line. Something I like about SVN’s design: that it includes praise by default. I’m not sure if it’s ironic or appropriate that the distributed VCSes are less sociable, here. :-)

                                                                                                              Hide whitespace noise / Show changed words instead of lines

                                                                                                              Whitespace: hg diff has a similar set of options.

                                                                                                              -w --ignore-all-space    ignore white space when comparing lines
                                                                                                              -b --ignore-space-change ignore changes in the amount of white space
                                                                                                              -B --ignore-blank-lines  ignore changes whose lines are all blank
                                                                                                              

                                                                                                              Mercurial doesn’t have --word-diff, though. It looks really nice, and I will definitely break out Git (or vimdiff) next time I could use this. Similarly nice: Github’s display, a line-wise diff with word-wise emphasis highlighting.

                                                                                                              See which branches you recently worked on

                                                                                                              Getting the ten branch heads with the most recent commit date is a job for revsets, of course; printing each one in a special way is a job for output templates.

                                                                                                              hg log -r 'limit(sort(head(), "-date"), 10)' -T '{rev} {bookmarks}\n'
                                                                                                              
                                                                                                              # git for-each-ref --count=10 --sort=-committerdate refs/heads/ --format="%(refname:short)"
                                                                                                              

                                                                                                              If you want the output to show commit IDs, dates, and branch names, add -T '{rev} ({date|isodate}): {bookmarks}\n'

                                                                                                              Something I like about Mercurial’s design: the clear separation of commit selection (the -r flag plus the revset DLS) and display (the -T flag plus the template DSL). Something I like about Git’s design: this Git command has placeholders with fully spelled-out names. Nice! Somebody should totally port that into git log’s --pretty format DSL.

                                                                                                              Also, you know how Mercurial users like to bring up consistency? This is a nice example of the importance of good names and consistent flags.

                                                                                                              • We have seen 3 log variants so far: log, shortlog, and for-each-ref.
                                                                                                              • The two commands with ‘log’ in the name are git log and git shortlog.
                                                                                                              • The two commands with log-like usage are git log and git for-each-ref.
                                                                                                              • The remaining command, git shortlog, has ‘log’ in its name, but is more interesting as a group-and-tally command: it either prepares changelogs (as its manpage suggests) or tallies churn (as seen in the article).
                                                                                                              • All three commands have different commit selection flags
                                                                                                              • All three commands have different formatting DSLs
                                                                                                              See what everyone’s been getting up to

                                                                                                              hg log + revsets again. And again we need only two flags: -r for commit selection, -T for display formatting.

                                                                                                              hg log -r 'date(-14) - merge()' -T '{rev} {desc|firstline}\n'
                                                                                                              
                                                                                                              # git log --all --since='2 weeks' --oneline --no-merges
                                                                                                              

                                                                                                              This is the sort of alias where we start to see bits (a revset, a template, even a template keyword) that we might want to reuse in other places, too. Let’s do that for a lark.

                                                                                                              # hgrc:
                                                                                                              #   [revsetalias]
                                                                                                              #   recent(datespec) = date(datespec) and not merge()
                                                                                                              #
                                                                                                              #   [templatealias]
                                                                                                              #   summary = '{desc|firstline}'
                                                                                                              #
                                                                                                              #   [templates]
                                                                                                              #   oneline = '{rev} {summary}\n'
                                                                                                              #
                                                                                                              #   [aliases]
                                                                                                              #   overview = log -r 'recent(-14)' -T oneline
                                                                                                              
                                                                                                              hg overview
                                                                                                              
                                                                                                              # git recent
                                                                                                              

                                                                                                              Admirably, Git ships with a one-line template by default. Mercurial doesn’t, though it is easy enough to define one. Admirably, hg log does not hide heads by default. Git’s log does hide heads (and I’ve seen it disorient many people), though it is easy enough to add --all.

                                                                                                              Remind yourself what you’ve been up to

                                                                                                              This is where we get to reuse the revsets and templates we defined in the previous section.

                                                                                                              # hrgrc:
                                                                                                              #   [aliases]
                                                                                                              #   recap = log -r 'recent(today) and user(<your e-mail>)' -T oneline
                                                                                                              
                                                                                                              hg recap
                                                                                                              
                                                                                                              Check which changes you’re about to pull / Review what you’re about to push

                                                                                                              Incoming! Does not require a fetch, either. Equally nifty: its brother, hg outgoing. When pushing/pulling, you can use -r to limit what you would push/pull to the ancestors of certain commits or bookmarks; as a result, hg incoming -r somebookmark works, too.

                                                                                                              hg incoming -T oneline --graph
                                                                                                              
                                                                                                              # git log --oneline --no-merges HEAD..<remote>/<branch>
                                                                                                              

                                                                                                              Something I like about Git’s design: namespaced tracking of last-known remote branch pointer positions was there from the start. I should check out Mercurial’s remotenames extension, though.

                                                                                                              Something I like about Mercurial’s design: it has first-class commands for a first-class mental concept. Providing hg incoming and hg outgoing is also very helpful to newbies: pushing and pulling is less scary if you can see for yourself what is about to happen.

                                                                                                              Generate a changelog

                                                                                                              You can probably guess what is coming: hg log -r ... -T ....

                                                                                                              hg log -r '<last tag>::master and not merge()' -T changelog
                                                                                                              
                                                                                                              # git log --oneline --no-merges <last tag>..HEAD
                                                                                                              

                                                                                                              Fancy-schmancy, automatically finding the most recent tag, and ordering by topological branch:

                                                                                                              hg log -r 'sort(
                                                                                                                  last(sort(
                                                                                                                      tag() and ancestors(master),
                                                                                                                      "date"
                                                                                                                  ))::. and not merge(),
                                                                                                                  "topo"
                                                                                                              )'
                                                                                                              

                                                                                                              Qua comparing Git and Mercurial, there’s nothing in here we haven’t gone over yet. And whatever your VCS, the most important point isn’t even the specific command you need to use – it’s that you should identify the mental concepts you repeatedly use, and throw them in an alias.

                                                                                                              (Come to think of it, every system that has power users – every system that rewards learning – all these systems, be they shells, or TeX; Excel, Vim, Mercurial, or Git – all these systems have aliases or macros, and every power user I know started out by writing macros to make their own lives easier. That, for many, is the first bite of the apple. And the systems reward them richly for it.)

                                                                                                              1. 2

                                                                                                                This is an awesome post. Please submit it as a separate post or turn it into a blog post and link here?

                                                                                                                1. 2

                                                                                                                  This post will make @jordigh proud when he sees it.

                                                                                                                  1. 5

                                                                                                                    Can confirm, am proud.

                                                                                                                    1. 1

                                                                                                                      :-)))