HN user

ezquerra

109 karma

TortoiseHg developer

Posts0
Comments26
View on HN
No posts found.

I recently found a small issue with `uv run`. If you run a script from outside the project folder, it looks for the pyproject.toml on the folder from which you are calling `uv run`, not on the folder where the python script is located (or its parents)! Because of that scripts that store their dependencies in a pyproject.toml cannot be run successfully using a “bare” `uv run path/to/my/script.py` from outside the project folder.

You can work around this surprising behavior by always using inline dependencies, or by using the `--project` argument but this requires that you type the script path twice which is pretty inconvenient.

Other than that uv is awesome, but this small quirk is quite annoying.

I am one of the Arraymancer contributors. I believe that what mratsim (Arraymancer’s creator) has done is pretty amazing but I agree that the scope is a quite ambitious. There’s been some talk about separating the deep learning bits into its own library (which I expect would be done in a backwards compatible way). Recently we worked on adding FFT support but instead of adding it to Arraymancer it was added to “impulse” (https://github.com/SciNim/impulse) which is a separate, signal processing focused library. There is also Vindaar’s datamancer (a pandas like dataframe library) and ggplotnim (a plotting library inspired by R’s ggplot). The combination of all of these libraries makes nim a very compelling language for signal processing, data science and ML.

Personally I’d like Arraymancer to be a great tensor library (basically a very good and ideally faster alternative to numpy and base Matlab). Frankly I think that it’s nearly there already. I’ve been using Arraymancer to port a 5G physical layer simulator from Matlab to nim and it’s been a joy. It’s not perfect by any means but it’s already very good. And given how fast nim’s scientific ecosystem keeps improving it will only get much better.

I recently started using nim for some little side projects and I am having so much fun. Somehow they’ve managed to combine the strengths of high level languages such as python with those of low level, systems languages like C with few (if any) of the drawbacks. It’s pretty amazing to be honest.

Programming in nim feels a lot like programming in a statically typed Python, except that you get small, fast, single file executables out of the box.

Compared to C++ you don’t need to worry about memory allocations too much except when you really want to, and when you do it is much simpler than in C or C++. It is also much easier to control mutability and the type system is much better. Also you can use most of the language at compile time in a much more elegant way than in modern C++.

Another surprising thing is that while the ecosystem is obviously much smaller than on more popular languages, the fact that it has a built-in package manager gives you access to it much more easily than in C++. There are a lot of high quality packages (such as datamancer, arraymancer and ggplotnim) which makes nim very productive in a lot of domains.

That’s not even including advanced things such as nim’s excellent macro system which I personally don’t use (but which enable some of the best nim libraries).

Oh, and I _love_ nim’s uniform function call syntax. Every other language should copy that feature.

I almost forgot to list the drawbacks. The main one of course is that it is not the most popular language (but the ecosystem is big enough that I didn’t find it is a big problem for my use case in practice). Other than that the editing and debugging experience could be improved. There is a decent VS Code plug-in (look for the one made by “saem”) but it is just OK, not great. There is some integration with gdb but it is a bit rough. I usually end up adding logs when I need to debug something.

The nim team is currently working on removing the garbage collector by means of a new reference counting based “garbage collector mode” called “arc” (for automatic reference counting). You can get more info in the following link, where it is described as “plain old reference counting with optimizations thanks to move semantics”:

https://forum.nim-lang.org/t/5734

The objective is to make nim suitable for embedded programming and other use cases for which garbage collection is a non starter. This new —gc:arc mode is already available in the nightly builds and the benchmarks are already impressive. I believe that the plan is to make arc the default “garbage collector mode” in nim 1.2.

Thank you Joeyaiello for your reply.

I understand your reasoning. I like some of your proposals. For example I'm all for making it easier to sign scripts, for example. Yet I feel that the possible solutions that you mention ignore the fact that you can bypass this "security" mechanism can be bypassed with a simple BAT file.

Why do PowerShell scripts require more security than a BAT file or an executable? Are users really safer thanks to the ExecutionPolicy check? Or are they simply worse off because people will either use less powerful BAT files or completelly opaque executables? At least with a PowerShell script you are able to inspect the code if you are so inclined. By pushing people to use executables instead they are less likely to know what changes will be done to the system.

If the problem is admins accidentally double clicking on unsigned scripts, by all means show a confirmation dialog (if the script is not signed) when a non signed script is _first_ executed. Actually, do that for BAT files and perhaps even for executables as well. But don't do it (by default at least) when someone calls a script explicitly from a command line or from another script. IMHO that would really make us all safer and would make PowerShell a real replacement for BAT files.

PowerShell is obviously a much better scripting language than the ancient DOS BAT "language" (if you can call it that). In theory it's also mostly ubiquitous on Windows which means that you can rely on it being there when creating a script. Yet I've found that often people keep using BAT files (e.g. in build scripts, etc). I think it is because you cannot just execute a PowerShell script unless it is signed or the user has manually enabled non signed script execution (by executing a command on the PowerShell command). This means you cannot rely on it just working, at which point it's often best to fall back to DOS or use another scripting language such a Python.

I understand that this is done for security reasons, but Windows already lets you execute any executable or BAT file that you might have downloaded from the Internet. So I'm not sure that disabling PowerShell script execution really gains you much (and there are probably other better solutions anyway).

So IMHO as long as DOS is available and PowerShell is so limited by default BAT files will not go away, which is unfortunate.

It is actually pretty simple. Mercurial automatically assigns a _local_, sequential revision number to every commit in your repository clone. In fact those revision numbers almost match the numbers in your examples (Commit 1 would have revision number 0, Commit 2 would be revision number 1, etc).

So in your example you would do:

"hg update 2" to checkout Commit 3, and "hg update 3" to checkout Commit 4

Note that these revision numbers are _local_ to your repository. That is, another clone of the same repository may have different revision numbers assigned to different revisions. The revision numbers are assigned in the order in which commits have been added to that particular clone.

You could of course also use the revision id (i.e. the SHA1 hash) to identify them. You do not need to use the whole revision id, just the part that makes it unique, usually the first few (e.g. 6-8) characters of the hash.

In addition Mercurial has a very rich mini-language to query and identify revisions in your repository. These queries are called "revsets". Most mercurial commands accept revsets wherever they would need to receive a revision identifier. With it you can identify revisions in many ways such as by date, by belonging to a given branch, commited by a certain author, containing a certain file, etc (and any combination of those and many others).

Finally, if you use a good mercurial GUI (such as TortoiseHg) the whole thing is moot because the GUI will show you the whole DAG and you can just click on the revision that you want and click the "Update" button.

I actually find the ability to create these "anonymous" branches really useful. Naming things is hard so I find that coming up with a name for each new short lived branch is annoying.

When you enable mercurial's evolve, history rewriting operations are no longer destructive. Mercurial's evolve creates a sort of repository "meta history" by saving every revision before you modify it (e.g. by using amend). It makes those saved, old versions "obsolete" and it "hides" them (so that they won't show on your DAG when you do "hg log", for example, unless you use the --hidden flag). Evolve also keeps track of the relationship between obsolete revisions and their "successors". That is, it will know whether a certain revision in your DAG is the result of amending one revision, or perhaps of folding several revisions into one, or splitting one revision in two or perhaps just removing a revision from the DAG (this is what I called repository meta history above).

Those hidden, obsolete revisions are not shown on your DAG and they are generally not pushed nor pulled. In most respects they behave as if they were not even there. It is only when you need them that you can show them or go back to them (by using the --hidden flag of some of mercurial's command such as hg log or hg update). This gives you a nice safety net (since rewriting history is no longer a destructive operation) that you can use _if you want_. It also makes it possible to rewrite revisions that you have already shared with other users (since when you push a successor revision you also push the list of revisions that it is the successor of).

I think evolve is a significant step forward on the DVCS paradigm as it enables safe, distributed, collaborative history rewriting. This is something that, AFAIK, was not possible up until now.

You are right. That is a small limitation of the graft command compared to the transplant extension. As far as I know that is the only difference between them. I have never needed to do that so I forgot to mention it, sorry!

I don't sure I understand what is the problem with setting up a basic mercurial server. If you have TortoiseHg you just open your repository, click on "Repository / Start Web Server" and you are done. If you have bare mercurial just cd to your repository and execute "hg serve".

Perhaps you have some other requirement (e.g. authentication) that I did not take into account?

The definitely do. They migrated their repositories to mercurial a while ago. There are plenty of mentions of this fact on mercurial's development mailing list (mercurial-devel@selenic.com).

Facebook is a big user and backer of mercurial. I attended the last mercurial sprint in Facebook's London office (which was great, BTW). Facebook will also host the next mercurial sprint in New York. They have recently hired Matt Mackall, mercurial's creator. Several other mercurial core developers also work for Facebook and are paid to work on improving mercurial as their main job.

I believe at some point they considered both git and mercurial as their new VCS. They have some huge repositories (hundreds of thousands if not millions of commits) and a huge amount of people accessing those repositories. I think they found some scalability issues with git's performance with repos of that scale (http://comments.gmane.org/gmane.comp.version-control.git/189...). Apparently it was easier for them to improve mercurial's performance, perhaps because mercurial is written in python with some performance sensitive parts written in C. Over the last year they have made a lot of progress and mercurial's performance on huge repositories is now even better than it used to be.

Mercurial comes with a built-in "hg serve" command that you can use to serve repositories through http. It creates a web server that you can access through any web browser. Unless you need authentication or you have a lot of users you don't need to setup any external web server.

Otherwise setting up Apache + mercurial on windows is not very hard. If you need help please drop me a line.

For the record, you don't need to enable the transplant and graphlog extensions anymore. Those are now part of core mercurial:

- The transplant extension has become the "graft" core command (do "hg help graft" for more details) - The graphlog extension functionality has been rolled into the core log command. You must simply use the --graph (or the equivalent -G) flag.

Git currently has a greater mindshare than mercurial, specially on HN and many open source circles. I don't think that is enough to consider that "git has won". There are big projects and big companies that use mercurial instead of git (e.g. Mozilla, Python, Facebook). Both git and mercurial are great and both can (and probably will) coexist for the foreseeable future.

If you only read proggit or HN you could think that everybody uses git. The reality is that there are many teams that use mercurial. There are many, many teams that are still using old style non distributed VCS. There are lots of teams that don't even use any VCS at all!

There are lots of people (myself included) who consider that git is needlessly complex, and that mercurial hits a better trade off between power and complexity. A lot of teams would be much better served by using mercurial instead of git. I know for example of several HW design teams that decided to use mercurial because they found it much easier to use.

In addition, I don't think that git or mercurial, as they currently stand, are the best we can do on a DVCS. There are plenty of areas where they both can improve (submodules / subrepos being one of them, but also better support for code review workflows, simpler / safer history rewriting, etc). Perhaps something else will come that will learn from git's and mercurial's mistakes and improve on what they offer?

What I mean by this small rant is that it would be foolish to consider that git has "won" and that there is nothing that can come and improve on it. I hope that the git devs don't think that way. I know that the mercurial devs definitely don't think that way, given the number of cool things that they are working on (e.g. with the evolve extension being my preferred one).

I find that your comment about mercurial's data model a bit ridiculous.

The reason why most introductions to mercurial do not mention its data model is because it is _not_ important. You really do not need to care about it at all on your day to day use. I've been using mercurial for years and I've never had to ask myself what is mercurial's data model.

IMHO the reason why git forces you to understand its data model is because its UI is terrible. It is a failure of the tool when you need to understand how it works internally to use it. If git's UI were better its awesome data model would be something that only git devs would need to understand.

If I want to contribute to a project I don't expect them to accommodate my workflow. I expect to be asked to comply with their workflow.

Let's say that I were the maintainer of a project in which we did not want to use named branches. If I got a pull request from someone that had created a named branch I would just kindly ask the contributor to remake his pull request, using bookmarks rather than a named branch.

The fact that they made a mistake _on their repo_ does not mean that that same mistake must end up on _my_ repo.As I said this is just a social problem.

You say that mercurial is unforgiving of mistakes. I say that mercurial makes sure that your _shared_ history is not lost. You can edit unshared history as much as you want.

As for MQ... I would say that it is an acquired taste :-> If you don't like it there are some good alternatives, such as histedit (also a built-in extension) and the new evolve extension which is still a work in progress but which already lets you safely edit _shared_ history.

Every project has the right to chose the VCS that they feel is right for them. However I find the reasons they give for the switch are pretty weak except for the last one (github is more popular).

1. Repository size: Such size differences are uncommon, and mostly likely due to the fact that the git repo was a brand new repo created from scratch by converting the original hg repo. If they repacked the mercurial repo it would probably be greatly reduced in size. They could also do:

    hg convert --config "extensions.convert=" --branchsort sqlalchemy sqlalchemy-smaller
Which results in a reduction of the repository size from 45 MB in the original to 24 MB in the converted repo. This is not as good as git but quite close IMHO.

2. This is not correct: Mercurial bookmarks _used_ to be an extension (a long time ago!) but they have been built into mercurial for a long time now. They are basically equivalent to git branches. So nowadays this is just a process issue. If using named branches is a problem just tell your devs to not use them and use bookmarks instead!

3. Mercurial's rebase and mq extensions are part of core mercurial. They are packaged and distributed with mercurial, their test suites are part of the mercurial test suite and they are supported and developed by the core mercurial developers. The only difference between a core command and one of the official extensions is that these must be manually enabled to be user (by adding a line to the mercurial config file). This is a good thing! This makes it harder to mess up your repo if you do not know what you are doing. If you are not knowledgeable enough to find and edit the mercurial config file you should definitely not be using rebase or collapsing your changesets.

The last reason on the other hand is one that I can understand and which I think has merit. Is it worth the hassle of changing their DVCS system? Perhaps. However it bothers me when legitimate _social_ reasons to switch from mercurial to git are supported by not quite as clear cut technical reasons such as the ones put forward in this blog post.

TortoiseHg developer here (i.e. I'm probably biased, take my comments with a grain of salt, yada, yada, yada...).

We discussed this a bit on the last mercurial sprint.

In jest, someone said that a lot of git users have what they'd call a "Helsinki syndrome". Probably that is not very far from the mark.

I think that what git brings in functionality is good enough (specially compared to non DVCSs) to make people want to use it and put the effort to understand it. On the other hand it is hard enough to use that when people finally manage to wrap their heads around it they are so proud that they must tell everybody about it.

It is actually quite brilliant if you think about it: Make a SW that does something really well, better than most other similar tools, but wrap it in a horrible UI to keep your users on their toes and make them proud that they are able to use it! This starts an incredible self-congratulatory feedback effect which gives notoriety to your tool.

If you add to that the fact that git was created by one of the most famous hackers of all time, plus the creation of GitHub, and then you get the perfect storm to make git the open-source tool of choice.

Mercurial on the other hand is just as useful (if not more) than git, but it is just not as hard to use. People use it, like it, but they do not need to feel proud about it. It is just easy. There is no need to talk about database details, reflogs, etc. There is no need to blog about it. It just works. This should be great and make mercurial the better tool but it has the perverse effect of not making it cool to talk about it. There is no challenge, there is no achievement in learning how to use mercurial. This makes it hard to get the same sort of buzz that you get from a tool such as git.

In my opinion it is a little surprising that such a knowledgeable bunch such as the Hacker News readers and the open source contributors in general are not able to evaluate both tools just in their technical merits and instead follow the buzz. Understandable, but surprising nonetheless.

This is quite nice but there are a few of things that I miss:

1. A way to have multi-line values for non array types

2. A more flexible number syntax (e.g. allow hex and binary integers, allow exponents on floats, allow NaN and +/-Inf)

3. Make it possible to have an extra comma after the last element on an array (as in Python)

4. Add a way to "include" another config file

#1 is important because some projects require all lines to have a max width of 80 lines, including on config files.

#2 is important for scientific/engineering projects. I think the current simple format shows that this format is a little too web centric. If this is going to be used for non-web stuff this is a must.

#3 is something that helps when putting this sort of configuration file in version control. Without this, adding an extra entry to a multi-line array creates a diff in two lines rather than 2 (since you must add a comma to the line above the one that you inserted). This is something I miss in JSON and which Python did just right (IMHO).

#4 would be useful in cases in which you want to provide a base configuration file for example.

Also, maybe I missed it but it is not super clear what would happen if you redefine an existing entry (I hope it is possible). Finally, is order important?

EDIT: typo.

I'm a TortoiseHg (mercurial GUI front-end) developer and an (occasional) mercurial contributor.

I think this is really great news, both for git, Microsoft and OSS in general. It is definitely a great move for Microsoft.

I hope they also add support for Mercurial in the future. Git is a great tool but I think Mercurial is equally powerful yet easier to use and understand (IMHO). It is not as widely used as git, particularly in OSS circles, but there are many OSS projects (e.g. Python) and many companies (e.g. Mozilla and Facebook) that use Mercurial very successfully. Choosing Git as the first DVCS they support makes a lot of sense, but Mercurial would be a nice second choice.

In particular, being able to use mercurial with TFS would be awesome in an enterprise context. Plus I'm sure all in the TortoiseHg project would welcome the competition if Visual Studio were to get builtin support for Mercurial as well as git :-)

My 19 month old lives one little game called "Animal Puzzle for Toddlers". It has got several simple puzzles where you have to place some animals on a drawing where they are missing. When you are fine there are balloons that appear on the screen which you can click making then explode. It's fun and simple.

There is a lite version, but the full version adds some more puzzles and it is very cheap (1$ if I recall correctly).

My Git Habits 14 years ago

In my opinion branching _used_ to not be as neatly implemented as it is in Git, but that is no longer the case.

A couple of versions ago a new feature was added into core mercurial, called "bookmarks". Mercurial bookmarks are the same as Git branches.

So now you can use the "git style branches" (i.e. bookmarks) in mercurial, or you can use the regular mercurial-style branches (which I personally prefer to git's anyway). In addition you can use "anonymous" branches, which AFAIK do not exist in git at all.

It could be argued that it already exists and that its called mercurial. Functionally equivalent to git, but with a _much_ simpler interface and better windows support.

Git has a little more momentum, probably because of Linus' pedigree, but I'm convinced that mercurial is objectively a better Git DVCS.

The blogger makes a few good points. I think part of the problem is that he seemed to expect TortoiseHg to hold his hand a little bit more while he was learning to use mercurial. Instead TortoiseHg expects you to have a basic understanding of the main mercurial concepts (i.e. clone vs push, etc). If you do I think the experience is much smoother, since we have been careful to follow mercurial's naming convenctions and workflow when possible.

In addition TortoiseHg has a pretty good (IMHO) online help that goes through some of these concepts and perhaps going through it would have helped him... Regardless I agree that the initial "new user" experience could be better and that expecting a user to RTFM is probably naive these days...

Out of the issues that are raised in that blog post I think the "No URL" one is the most serious. TortoiseHg should make it easy for you to understand and fix the problem. I am looking into it and hopefully it will be better handled on the next version of TortoiseHg (2.4).

What I plan to do, other than improving the error message itself, is to show the "Sync widget" whenever a user tries to push without having configured a remote repository first.

Please let me know of any other problems or improvements that you'd like to see, and I'll see if we can do something about them.

Could you elaborate? In which way you feel that TortoiseHg lacks polish? I'm not saying it doesn't, but we are really trying to make it the best cross platform mercurial client out there and are always looking for ways to improve it. Suggestions and constructive criticism are always welcome!