Domanda

I'm newbie to both Mercurial and Python and I was thinking if its possible to capture list of all committed change set id (hash) and then iterate/loop through list of each change sets and print its hash (id) value one by one.

So far I've defined precommit hook in my mercurial.ini config file to fire a function:

mercurial.ini

precommit = python: d:\workspace\Hello.py:precommit_printID

Hello.py

def precommit_printID(ui, repo, *args, **kwargs):

  print ("ui: ", ui)

I mean its just basic and this is how far I've go into it, would be nice if you could show me how can that be done.

Many thanks!

È stato utile?

Soluzione

Check out the "Generic pretxncommit/pretxnchangegroup Hook" on this page: https://www.mercurial-scm.org/wiki/HookExamples

It shows exactly how to walk through the changesets being committed or pushed.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top