hg clean is pure evil

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

hg clean is pure evil

Aardwolf
hg clean is a very dangerous command imho. I've lost files multiple times due to it. The problem is that it sounds a lot like the "cleanup" command of SVN, and I've typed "hg clean" a few times already with a different intention (in the hope it'd fix things), but instead it removed unversioned files, such as my project file and complete local pieces of code...

I just had to say it...
Reply | Threaded
Open this post in threaded view
|

Re: hg clean is pure evil

Masklinn
On 2010-11-05, at 12:14 , Aardwolf wrote:
> hg clean is a very dangerous command imho.
It's not.

> I've lost files multiple times due
> to it. The problem is that it sounds a lot like the "cleanup" command of
> SVN, and I've typed "hg clean" a few times already with a different
> intention (in the hope it'd fix things)
So you use commands randomly with no understanding of what it does?

> but instead it removed unversioned
> files, such as my project file and complete local pieces of code…
Why don't you either ignore or version your project files? hg clean will only touch (and remove) files appearing as unknown in `hg status` (barring a bug in clean). The general rule is to ignore any file you need but do not want to version (e.g. the files generated by virtualenv when you work on a Python package), and in that case `hg clean` is perfectly safe.

Same for whatever "complete local pieces of code" are supposed to be, `hg clean` only removes files marked as unknown by hg status.
_______________________________________________
Mercurial mailing list
[hidden email]
http://selenic.com/mailman/listinfo/mercurial
Reply | Threaded
Open this post in threaded view
|

Re: hg clean is pure evil

Dirkjan Ochtman
I don't know; I didn't know that "clean" was an alias for "purge", and
I think removing that alias by default might actually be a good idea.
Easy enough to add it back, after all.

Cheers,

Dirkjan
_______________________________________________
Mercurial mailing list
[hidden email]
http://selenic.com/mailman/listinfo/mercurial
Reply | Threaded
Open this post in threaded view
|

Re: hg clean is pure evil

Aardwolf
Oh, thanks, I had the purge extension enabled, I can indeed just disable that extension and my "dangerous situation" is solved, I didn't know the clean was there due to that extension :)
Reply | Threaded
Open this post in threaded view
|

Re: hg clean is pure evil

Aardwolf
In reply to this post by Masklinn
When using the combination of an IDE with rather sloppy mercurial integration, and using multiple version control systems in different situations, then yes such an accidental mixup of commands can happen... :(
Reply | Threaded
Open this post in threaded view
|

Re: hg clean is pure evil

Mads Kiilerich
In reply to this post by Aardwolf
On 11/05/2010 12:14 PM, Aardwolf wrote:
>
> hg clean is a very dangerous command imho.

Yes - and that's why it isn't a core command and isn't enabled by
defualt. You only have the purge/clean command if you have enabled the
purge extension.

/Mads
_______________________________________________
Mercurial mailing list
[hidden email]
http://selenic.com/mailman/listinfo/mercurial
Reply | Threaded
Open this post in threaded view
|

Re: hg clean is pure evil

Dirkjan Ochtman
On Fri, Nov 5, 2010 at 13:00, Mads Kiilerich <[hidden email]> wrote:
> Yes - and that's why it isn't a core command and isn't enabled by defualt.
> You only have the purge/clean command if you have enabled the purge
> extension.

Still, I think my model for something called "clean" is quite
different from something called "purge".

Cheers,

Dirkjan
_______________________________________________
Mercurial mailing list
[hidden email]
http://selenic.com/mailman/listinfo/mercurial
Reply | Threaded
Open this post in threaded view
|

Fwd: hg clean is pure evil

Dirkjan Ochtman
In reply to this post by Dirkjan Ochtman
(forwarded to the list)

---------- Forwarded message ----------
From: [hidden email] <[hidden email]>
Date: Fri, Nov 5, 2010 at 15:03
Subject: Re: hg clean is pure evil
To: Dirkjan Ochtman <[hidden email]>

I second Dirkjan's suggestion. "hg clean" is not user friendly imo.

On Fri, Nov 5, 2010 at 06:32, Dirkjan Ochtman <[hidden email]> wrote:

> I don't know; I didn't know that "clean" was an alias for "purge", and
> I think removing that alias by default might actually be a good idea.
> Easy enough to add it back, after all.
>
> Cheers,
>
> Dirkjan
> _______________________________________________
> Mercurial mailing list
> [hidden email]
> http://selenic.com/mailman/listinfo/mercurial
>
_______________________________________________
Mercurial mailing list
[hidden email]
http://selenic.com/mailman/listinfo/mercurial
Reply | Threaded
Open this post in threaded view
|

Re: hg clean is pure evil

Augie Fackler
In reply to this post by Dirkjan Ochtman
On Fri, Nov 5, 2010 at 7:04 AM, Dirkjan Ochtman <[hidden email]> wrote:
> On Fri, Nov 5, 2010 at 13:00, Mads Kiilerich <[hidden email]> wrote:
>> Yes - and that's why it isn't a core command and isn't enabled by defualt.
>> You only have the purge/clean command if you have enabled the purge
>> extension.
>
> Still, I think my model for something called "clean" is quite
> different from something called "purge".

+1

>
> Cheers,
>
> Dirkjan
> _______________________________________________
> Mercurial mailing list
> [hidden email]
> http://selenic.com/mailman/listinfo/mercurial
>
_______________________________________________
Mercurial mailing list
[hidden email]
http://selenic.com/mailman/listinfo/mercurial
Reply | Threaded
Open this post in threaded view
|

Re: hg clean is pure evil

Matt Schulte
Just out of curiosity, how bad/hard would it be for the purge/clean
extension to be less parmanent?  Perhaps something akin to a trashcan
that isn't automatically emptied.

Matt Schulte
_______________________________________________
Mercurial mailing list
[hidden email]
http://selenic.com/mailman/listinfo/mercurial
Reply | Threaded
Open this post in threaded view
|

Re: hg clean is pure evil

Bryan O'Sullivan
In reply to this post by Masklinn
On Fri, Nov 5, 2010 at 4:26 AM, Masklinn <[hidden email]> wrote:

> It's not.

I'd be inclined to side with Aardwolf on that. Yes, it is dangerous
because of its similarity to the "svn cleanup" command. "purge" on the
other hand is fine, as it sounds safer.
_______________________________________________
Mercurial mailing list
[hidden email]
http://selenic.com/mailman/listinfo/mercurial
Reply | Threaded
Open this post in threaded view
|

Re: hg clean is pure evil

Steve Borho
In reply to this post by Matt Schulte
On Fri, Nov 5, 2010 at 10:38 AM, Matt Schulte
<[hidden email]> wrote:
> Just out of curiosity, how bad/hard would it be for the purge/clean
> extension to be less parmanent?  Perhaps something akin to a trashcan
> that isn't automatically emptied.

Pretty easily, the purge extension is not a lot of code.

http://www.selenic.com/hg/file/515c2786e1cf/hgext/purge.py


--
Steve Borho
_______________________________________________
Mercurial mailing list
[hidden email]
http://selenic.com/mailman/listinfo/mercurial
Reply | Threaded
Open this post in threaded view
|

Re: hg clean is pure evil

Dennis Brakhane
In reply to this post by Bryan O'Sullivan
(forgot to cc the list)

On Fri, Nov 5, 2010 at 7:51 PM, Dennis Brakhane <[hidden email]> wrote:

> On Fri, Nov 5, 2010 at 4:38 PM, Bryan O'Sullivan <[hidden email]> wrote:
>> I'd be inclined to side with Aardwolf on that. Yes, it is dangerous
>> because of its similarity to the "svn cleanup" command. "purge" on the
>> other hand is fine, as it sounds safer.
>
> Not only that, it's also dangerous if you happen to have a make/ant
> target called
> "clean" and confuse "ant" and "hg". I like how git handles this. "git
> clean" does nothing, you have to supply
> "-f" to let it actually do anything. Of course, in git "clean" is
> always activated and doesn't require
> you to explicitely enable an extension.
>
> But even when you intend to use a command like "hg clean", I find it
> useful to require
> a force setting, for the reasons stated above.
>
_______________________________________________
Mercurial mailing list
[hidden email]
http://selenic.com/mailman/listinfo/mercurial