tip: getting the files which might be affected by a merge
Steve (Gadget) Barnes
gadgetsteve at hotmail.com
Mon Sep 7 16:37:44 UTC 2015
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
On 07/09/2015 14:57, Arne Babenhauserheide wrote:
> Hi,
>
> A collegue asked me how to get all the files which could be affected by a merge. With some help from killerix and Anoia in #mercurial and “set operations in the unix shell” (http://www.catonmat.net/blog/set-operations-in-unix-shell-simplified/), I came up with this clean solution:
>
> hg diff -r "ancestor(.,other) -r . --stat | cut -d "|" -f 1 | sed "s/ *$//" > /tmp/1
> hg diff -r "ancestor(.,other) -r other --stat | cut -d "|" -f 1 | sed "s/ *$//" > /tmp/2
> comm -12 <(sort /tmp/1) <(sort /tmp/2)
>
> I thought it could be interesting for others, too :)
>
> Best wishes,
> Arne
>
> PS: I also addid it to the wiki:
> https://mercurial.selenic.com/wiki/TipsAndTricks#list_files_which_might_be_affected_by_a_merge
>
> --
> A man in the streets faces a knife.
> Two policemen are there it once. They raise a sign:
>
> “Illegal Scene! Noone may watch this!”
>
> The man gets robbed and stabbed and bleeds to death.
> The police had to hold the sign.
>
> …Welcome to Europe, citizen. Censorship is beautiful.
>
> ( http://draketo.de/stichwort/censorship )
>
>
>
>
> _______________________________________________
> Mercurial mailing list
> Mercurial at selenic.com
> https://selenic.com/mailman/listinfo/mercurial
>
You can get the same sort of effect, without the unix magic, by using
changesets and templates:
e.g.:
hg log -r ::otherrev - ::thisrev --template={rev}:{node|short} Changes:
{join(files, ", ")}"
Which will list out, for each revision that is a member of ancestors of
otherrev that are not ancestors of thisrev, the rev number and the
impacted files.
I have used this to great effect.
Gadget/Steve
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQEcBAEBCAAGBQJV7b1YAAoJEPv0ETl4DpztDToIAKVVPTLgyLzCvDlFiY/RkJ25
kZQ2vDsCu4nI5xaDA/uDGROvtPbD6atvtYfD4QKhUByvBc9YiecbHp8NMcVo7OPJ
EyUgrjWto6NfTXVB71IOzgVEgKvJNJMduCkvMvedxqTs7XlmSnHWO/u/7m08hIWN
gWgIqNModl9KrfG/mY5WK26xEBgoOGHig2w4xNd9Af+LOD4NJklUoe3NeXP003wI
4l6qAwN+wMNHpNkbGx6jINmYkvnYX1XF668Xsv2CR1b6Y8BsA3KbVoLopIOYnnZY
YEKTuWJEjIc7Dsx2isamUDzVsry6GU9ijpXDAjb8rNTVe0D/OhkR5SLd3KQOsoo=
=G/Qh
-----END PGP SIGNATURE-----
More information about the Mercurial
mailing list