Mercurial: create new user incl. password - mercurial

I have a new private repository and I'd like to add users to push/pull.
So, my question is: How can I create new users, incl. a password?
After that, I know that I have to add them to the hgrc-file.
Thanks a lot for any help :)

That depends on how did you configured to host your repo. The easy solution is to use hg through ssh, but you can follow different aproaches as well (e.g., we're using SCM with LDAP). Unfortunately, I don't think there's an easy way to do that with hg serve...
You can also try any public hosting companies like BitBucket, probably that's the easiest way.

Related

When remove someone from paid private repo, will they still be able to push code

i tried doing some research on this, but i wasnt able to find a solid answer.
The situation is, at our company we want to get rid of an employee, but he has a lot of access to our software. If we were to remove him from our paid private repo on github, will that deny them access to push any code?
We also use MySQL workbench, how would we deny him access to change stuff in the database, and AWS.
Any help would be great, not much into tech. Our main goal is to remove this person from company so they wouldnt cause harm to system in the future
When you remove someone from a private git repo, they cannot push or pull from your repo anymore. The only thing they might still have are local copies of the repo of they forked or saved a copy on their machine
https://help.github.com/en/github/setting-up-and-managing-organizations-and-teams/removing-a-member-from-your-organization
They will lose access to private forks of your organization's private
repositories, but may still have local copies. However, they cannot
sync local copies with your organization's repositories. Their private
forks can be restored if the user is reinstated as an organization
member within three months of being removed from the organization.
Ultimately, you are responsible for ensuring that people who have lost
access to a repository delete any confidential information or
intellectual property.

With Mercurial: How to record different machines source code changes happened on

I use Mercurial on 2 different computers changing the same repository. If I want to keep tabs on which changes have happened on which machine, how should I record this?
I came up with the idea of using different user names on the two machines ([ui] -->
username variable in the hg config file), but does a more appropriate mechanism/variable exists for this?
This looks like a good idea; user names are exactly to identify the committer, here the computer. The alternative would be to work on different branches on each computer and merge in default often. However, the latter is more error-prone.
For a couple of years, you've been able to expand shell variables inside .hg/hgrc files.
So I just do something like this in my .bash_profile:
export HGUSER=$(hostname)
Then inside .hg/hgrc:
username=${HGUSER}
The BIG ADVANTAGE of this technique is that now you can put the EXACT SAME .hg/hgrc on ALL the machines. The same is true of .bash_profile: it can be the same on all machines. This helps a lot when you're automating machine configurations!
Note: the HGUSER environment variable is an old way of telling Mercurial your username, so, technically, setting HGUSER in .bash_profile ought to solve the problem on its own, but I believe its use is deprecated/discouraged, and I recommend defining username in .hg/hgrc explicitly, as I've shown above.

Pushing/Pulling specific files/folders in Mercurial

I am (still) trying to completely migrate our company's SVN to HG.
For the most part I've succeeded, but we ran across a problem.
Our codebase has over 30 different projects, each one on its folder.
I've been asked multiple times how to commit and then push specific files to our central repository instead of being forced to commit everything everywhere to then push it, it's certainly annoying. Not being able to pull only specific projects is also an nuisance.
Is there any way to handle this like we used to in SVN? Where we could just commit what we wanted and not everything, and update only what was necessary.
Thank you.
A major difference between SVN and Mercurial is that you should have one repository per project in Mercurial.
You can change your repository to be multiple repositories using the convert extension.
Like Steve Kaye said you should create one repo per project, but as well you may want to create one master repo and include all your projects as subrepos This will allow svn like behavior of getting a copy of everything.

Multi-user access for Mercurial sub-repositories

What is the right way to organize ssh access to sub-repositories in mercurial?
Consider the following situation:
master
|--.hgsub
|--slave1
|--slave2
And .hgsub:
slave1 = ssh://user#host://var/local/repos/slave1
slave1 = ssh://user#host://var/local/repos/slave2
The problem is that .hgsub is the part of the repository thus it is not possible (or is it?) to store various usernames in the ssh addresses of the repos. And I really want to avoid using a "global" user to access the repositories just because of this.
You have basically two choices:
If your subrepositories live in the same server as the container, use relative paths. This is the most convenient solution.
Otherwise, you can have each user define a subpath rule. Look for the subpath word in this document.

How can I commit a set of files only once in Mercurial?

I have some files I'd like to add to have them as a "backup". The thing is, I'd like to commit them only one time, and then, I'd like for Mercurial to don't track them anymore ( don't notify me if they're changed, and don't commit them on other commits ).
Basically, something like this:
hg add my_folder
hg commit -m "added first version of my_folder"
Then, after a while, the contents of that folder might change. And if I commit other files, the new version of that folder will get commited as well. This is something I'd like to avoid. Is it possible, without specifying directly which files I want to commit?
I've never seen any option in Mercurial that might allow that... but why not simply copy them elsewhere ?
I mean, what's the point of using a Version Tracking System if you don't need versioning on these items anyway ?
We ran into a similar case with binary documents ('.doc', images, etc...) and finally decided to commit them on a separate repository, dedicated to those.
I think the traditional way of doing this is to commit files named something like "file.ext.default", and just inform users that they should copy the defaults and modify the copies.
VCSs aren't backup sysytems. consider using a proper backup mechanism.
having said that you should be able to do this using hooks, there are many ways you could do this but ACLs would be an obvious one assuming a remote server