Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mercurial: Forget files of a certain extension

How do I remove all files from a mercurial repository having the .class extension?

This use of patterns does not work:

PS> hg forget -I **.class
abort: no files specified

However, this use of patterns lists all the files I would like to forget:

PS> hg status -A -I **.class
C be\ac\ulg\montefiore\run\distributions\DiscreteDistribution.class
C be\ac\ulg\montefiore\run\distributions\ExponentialDistribution.class
C be\ac\ulg\montefiore\run\distributions\GaussianDistribution.class
C be\ac\ulg\montefiore\run\distributions\GaussianMixtureDistribution.class
C be\ac\ulg\montefiore\run\distributions\MultiGaussianDistribution.class
C be\ac\ulg\montefiore\run\distributions\MultiRandomDistribution.class
C be\ac\ulg\montefiore\run\distributions\PoissonDistribution.class
C be\ac\ulg\montefiore\run\distributions\RandomDistribution.class
C be\ac\ulg\montefiore\run\distributions\SimpleMatrix.class
C be\ac\ulg\montefiore\run\jahmm\Centroid.class
C be\ac\ulg\montefiore\run\jahmm\CentroidFactory.class
C be\ac\ulg\montefiore\run\jahmm\CentroidObservationInteger.class
C be\ac\ulg\montefiore\run\jahmm\CentroidObservationReal.class
C be\ac\ulg\montefiore\run\jahmm\CentroidObservationVector.class
C be\ac\ulg\montefiore\run\jahmm\ForwardBackwardCalculator$Computation.class
C be\ac\ulg\montefiore\run\jahmm\ForwardBackwardCalculator.class
C be\ac\ulg\montefiore\run\jahmm\ForwardBackwardScaledCalculator.class

What am I not understanding about the way forget treats patterns? I am using Mercurial version 2.0.

like image 430
Matthew Ross Avatar asked Nov 15 '11 19:11

Matthew Ross


1 Answers

You're just missing a little something in your command :

 hg forget -I **.class .

Note the added . at the end which tells Mercurial in which directory to look.

It's working with status, because status look in every directory by default if nothing is specified. For the forget command you must specify the files / directory explicitly

like image 123
krtek Avatar answered Sep 22 '22 08:09

krtek