In the Mercurial API, is there any way to read the configuration values associated with a repository that you're accessing over HTTPS? The repository's ui object doesn't seem to hold them.
The short answer is "no". There is no way to read the config values from a repo over HTTP using the Mercurial API. These values are never transmitted over the network. A more detailed explanation follows.
The ui.ui() class provides access to system, user and local repository config values.
>>> from mercurial import hg, ui
>>> u = ui.ui()
>>> u.configlist('ui', 'username')
['Your', 'Name', '<your#email.com>']
The constructor for a repository object requires a ui object and a path to be provided.
The values from ui are copied into the repo object.
If path is a local repository, then the config settings for that repository may be accessed via repo.ui. However if path is a URL, the API does not query the remote server for config settings. In that case, repo.ui only includes the system and user settings.
>>> repo = hg.repository(ui.ui(), '.')
>>> repo.ui.configlist('paths', 'default')
['https://www.mercurial-scm.org/repo/hg']
... start an hg serve session at http://localhost:8000 ...
>>> repo = hg.repository(ui.ui(), 'http://localhost:8000')
>>> repo.ui.configlist('paths', 'default')
[]
Related
How can I publish my node on network using sawtooth hyperledger-sawtooth application
I am new on sawtooth try to use below git repro
git repro for this is
I have found some links regarding this
https://lists.hyperledger.org/pipermail/hyperledger-stl/2018-January/000146.html
here is course guide for sawtooth
Hyperledger courseguidelink
already ask a question on GitHub
https://github.com/hyperledger/education/issues/18
Here is code i am using
https://github.com/hyperledger/education/tree/master/LFS171x/sawtooth-material/sawtooth-tuna
If we wish to connect two nodes using the file you only need the following need to use validator.toml, inside /etc/sawtooth
If this file is not there then we need to create that:
$ cd /etc/sawtooth
$ sudo touch validator.toml
Remember to execute below line to run the validator with sawtooth:
$ sudo chown root:sawtooth validator.toml
Sample validator.toml file contents:
# Set the network and component endpoints
bind = [
"network:tcp://127.0.0.1:8800",
"component:tcp://127.0.0.1:4004"
]
# The type of peering approach the validator should take
peering = "static"
# Advertised network endpoint
endpoint = "tcp://127.0.0.1:8800"
# Uris to initially connect to the validator network
seeds = ["tcp://127.0.0.1:8801"]
# A list of peers to attempt to connect to
peers = ["tcp://127.0.0.1:8801"]
I have an open source windows store application (UWP). When I associate the application with the store a Package.StoreAssociation.xml and a <AppName>_StoreKey.pfx is created along with some modifications to my Package.appxmanifest (Identity Tag; Name and Publisher Attributes).
Can I commit that information to a public git repository (the certificate must be in the repository because I want to build the package with AppVeyor)?
Should I encrypt it?
Could I revoke the certificate if it leaked?
Are the changes to appxmanifest sensitive?
You should not include <AppName>_StoreKey.pfx file to your public repo. However you can still use AppVeyor CI.
1.Change your *.csproj file to include this information.
<PropertyGroup Condition="('$(Configuration)' == 'Debug') Or ('$(UseTemporarySignCert)' == 'true')">
<PackageCertificateKeyFile><AppName>_TemporaryKey.pfx</PackageCertificateKeyFile>
</PropertyGroup>
<PropertyGroup Condition="('$(Configuration)' == 'Release') And ('$(UseTemporarySignCert)' != 'true')">
<PackageCertificateThumbprint><!-- Your <AppName>_StoreKey.pfx Thumbprint Here --></PackageCertificateThumbprint>
</PropertyGroup>
2.Import your <AppName>_StoreKey.pfx certificate to: store location - Current User, Certificate store - Personal
3.Add UseTemporarySignCert environment variable with value true to your AppVeyor project.
As result you will be able to build signed project by your own without <AppName>_StoreKey.pfx in release mode and publish then to the store.
And AppVeyor will work with TemporaryKey.pfx.
Can I commit that information to a public git repository (the certificate must be in the repository because I want to build the package with AppVeyor)?
For public git repository, the Store key .pfx file should not be committed(Add to .gitignore file). If you want to use the CI system, please create a private repository or append the .pfx file to your cloned project in CI backend.
Should I encrypt it?
This file has been encrypted and it's for signing your app before submitting to Windows Store, see also How to create an app package signing certificate
Could I revoke the certificate if it leaked?
You need to reserved a new app name, see here
Are the changes to appxmanifest sensitive?
Depends on what you have changed, it's very important for Identity and package information in .packagemanifest file. See App package manifest
I have a team set up on bitbucket with multiple users, and I'm using the keyring extension for mercurial. I need to set up a subrepo, and in the .hgsub file I need to provide the url for the subrepo.
If I use https://bitbucket.org/team/subrepo then the user needs to authenticate each time they try to pull.
If I use https://userX.bitbucket.org/team/subrepo then each user will need to authenticate with userX's password.
If I use https://team.bitbucket.org/team/subrepo then each user will need the team's password.
Is there a way I can set it up so that the authentication can be saved using the keyring extension, but still have separate credentials for each user, without using ssh?
Yes, you can enter your authentication information into your config file. The documentation for this is here.
In the auth section of each user's config file you can enter the following details:
[auth]
bb.schemes = http https
bb.prefix = bitbucket.org/team
bb.username = userX
The bb part is just a tag to group the settings together - you can use what you like and you can have more than one set if you have more than one Mercurial server that you use.
The example settings say that all repositories that start http://bitbucket.org/team or https://bitbucket.org/team should use the username of userX. The keyring extension will take care of the password after that.
This may seem like a dumb idea, but is there anyway to serve a mercurial repository over http without any of the webinterface features bundled in hgweb.cgi .
I would like users to be able to clone/push the repository over http:// but I do not want them to be able to view the repositories or files through a web interface.
Static HTTP is an option, but the official mercurial docs claim that this is very slow.
If this is not trivial, is anyone aware of a example code that serves an hg repository over http, without any support for a browser interface preferrably?
Thanks in advance.
I did a quick check of the hgweb files and found this:
Find the hgweb/webcommands.py file of your mercurial installation, and open it in an editor. Change the following code at the top of the file:
__all__ = [
'log', 'rawfile', 'file', 'changelog', 'shortlog', 'changeset', 'rev',
'manifest', 'tags', 'bookmarks', 'branches', 'summary', 'filediff', 'diff',
'annotate', 'filelog', 'archive', 'static', 'graph', 'help',
]
to this:
__all__ = [
]
This disables all web commands; you can still view the list of repos, but not any more infos about them.
I did check hg clone and hg pull, but not hg push.
I don't know why you want to restrict access to the UI part since any information provided here is accessible if they can access the files, but so be it :P
If you want some clean solution, I think taking the code of hgweb.cgi and rewrite it won't be too difficult, but I think you can also do something quicker : hg serve -t /dev/null
This will use /dev/null as the template for the UI part, so the users will receive an "Internal Server Error" page when connecting to the server but will be able to access the repository just fine through hg.
Only downside, the log will be field with errors if there's access through a browser.
PS: if you're not on a Unix system, just use any empty directory as a source for the templates.
I have a repository set up on an apache web server using the hgweb.cgi script declared in my apache2.conf file as following:
ScriptAlias /hgp "/var/www/hgrepublic/hgweb.cgi"
In my hgweb.cgi script, if I set the config variable as the path to my repository:
config = "/var/www/hgrepublic/fakecake"
it works and I see the history of my repository at http://localhost/hgp
Now if I want to use the hgweb.config file, I set the config variable in the hgweb.cgi script like:
config = "hgweb.config"
whatever the paths I try to use in config file, I cannot see my repository in the web interface (empty repository index). Here are a few examples I tried with absolute and relative paths
[paths]
/ = /var/www/hgrepublic/**
fakecake = /fakecake
fakecake = /var/www/hgrepublic/fakecake
Any idea to help me make it work with the config file? (I would like to have several repositories declared in the config file)
Note: hgweb cgi and config files are in the /var/www/hgrepublic/ folder as well as the fakecake repository folder.
I found a solution to my own question by looking at the source.
I used a dict in the hgweb.cgi file to pass the different repositories I want to show:
config = {'repo1' : '/path/to/repo1', 'repo2' : '/path/to/repo2'}
It works like this, so I think that there might be a parsing problem in hgweb.config file for [paths] section?
The [paths] section converts the URL to the repository path. Try:
hgweb.config
[paths]
/hpg/fakecake = /var/www/hgrepublic/fakecake
/hpg/repo2 = /var/www/hgrepublic/repo2
hgweb.cgi
config = "hgweb.cgi" # or /path/to/hgweb.cgi if not in cwd