sheenobu dot net

2021-04-28 - Mercurial - Outgoing script

My nixos config is setup to support hg push for deployment so I end up with multiple paths. Knowing which paths are going to get which commits is important.

% bash scripts/outgoing.sh
deploy
%=====================================================================%
% comparing with /etc/nixos/config                                    %
% searching for changes                                               %
% changeset:   15:6cfe9d3fd71f                                        %
% user:        sheenobu <sheena.artrip@gmail.com>                     %
% date:        Sat Apr 24 03:20:24 2021 -0700                         %
% summary:     update home                                            %
%                                                                     %
% changeset:   16:27689ec1a7e7                                        %
% user:        sheenobu <sheena.artrip@gmail.com>                     %
% date:        Sat Apr 24 03:23:19 2021 -0700                         %
% summary:     add dancer nixpkg config                               %
...
%=====================================================================%
home-deploy
%=========================================================%
% comparing with /home/sheenobu/.config/nixpkgs/config.hg %
% searching for changes                                   %
% no changes found                                        %
%=========================================================%

Exercise for the reader: simplify the "tr | awk | sort | uniq" as a single expression or command. Use perl, awk, or grep.

#!/bin/sh
hg paths | tr ':' ' ' | awk '{ print $1 }' | sort | uniq \
  | xargs -I % /bin/sh -c 'echo %; hg outgoing % | boxes -d tex-box || :'
← Back to /snippets