How to update to a branch by name? - mercurial

I've just been doing
hg up mybranch
Until now, which mostly works fine, but we've got a handful of branches that just have numbers for their name. How is up supposed to differentiate between a revision number and a branch name? It doesn't seem to support the -b option and I'm not aware of any other method of updating to a branch by name, so what's the proper way of doing it?

Use the branch() revset operator like this:
$ hg update "branch(123)"
That way you can distinguish between revision numbers, branch names, tags, etc. if you've managed to create an ambiguous name. It's of course discouraged to create such names in the first place, but I'm sure you have figured that out by now :-)

Related

How to set up an immutable dnslink to IPFS content?

I am trying to achieve the same as these guys did: https://uniswap.org/blog/ipfs-uniswap-interface/
So first I read this:
https://docs.ipfs.io/concepts/ipns/
It says:
IPNS is not the only way to create mutable addresses on IPFS. You can
also use DNSLink, ...
So I went to read https://dnslink.io/, and then added a TXT _dnslink dnslink=/ipfs/<CID> entry to my DNS records.
Works perfectly.
But what about an update to content - won't the CID change? Do I have to update the TXT record every time the content changes? Is there a way to have the dnslink record point to always the last release?
https://uniswap.org/blog/ipfs-uniswap-interface/ says:
That TXT record contains the IPFS hash of the latest release.
So it suggest that it needs to be updated all the time. Maybe there is a programmatic way to update the TXT record so they don't have to go in all the time and change the hash?
Sligthly confused ¯_(ツ)_/¯
You can either:
Update the /ipfs/ CID in the TXT every time, programmatically or otherwise. Or, use an /ipns/ CID. With IPNS, you never need to update the TXT, but you need at least 1 IPFS node with the IPNS key to be online most of the time to regularly publish the IPNS record. If you do use IPNS, I recommend generating a new key for the content, not using the default node keypair. This makes it easier to move / copy the key.

How can I update to the end of the current unnamed branch?

I thought hg update (with no arguments) would move me to the end* of the current [unnamed] branch, but I believe it will try crossing branches if the other one is newer, which is not what I want to do.
* I'm deliberately avoiding the word "tip" because "tip" refers to the most recent revision, regardless if that named branch has two or more heads.
I'll give some example.
2 4 (tip)
o------o
/
o---o
\
o---o
1 3
I'm at 1, but I want to update to 3 (the end of the branch I'm on). If I type hg update with no arguments it will actually error with the message "abort: crosses branches (merge branches or update --check to force update)". In some scenarios it might even say "abort: not a linear update (merge or update --check to force update)" but I'm not quite sure what triggers that (if you know, please tell me).
If I do hg update --check it will move me to 4 (the tip of the current named branch), which is not what I want either.
I can check hg log to find out the changeset for 3 and then hg up 3, but I would like to do it in one command because trying to understand the log is tedious.
Perhaps revsets could be of use, but I don't know which one would help me.
So, how can I update to the end of the current unnamed branch?
A plain hg update tries to take you to 4 (not 3) because it always tries to take you to the newest (technically "most tipward") revision on the requested branch, or default if unspecified. So it doesn't matter if you're on 0, 1, or 3, hg update is always saying take me to 4 with the graph above (assuming all revisions are on the same named branch).
Your revset to take you to the greatest descendent of your current revision is great, but if you find yourself navigating between multiple heads on the same named branch often consider dropping a bookmark on each of them. A bookmark is like a tag that auto-advances on commit, so if you do:
hg bookmark -rev 3 mybranch
hg checkout mybranch
you'll end up with the 'bookmark' mybranch that will always move forward as new child changesets are added, and you can always get back to it with hg checkout mybranch

Replace MySQL values in over 120 tables

We have redirect huge internet service from domain .de to domain .com - this is discussion board (vBulletin). At the moment we need to change all phrases like "domainame.de" to "domainame.com":
Over 120 tables (posts, threads)
A lot of MySQL fields
Anyone have suggestion how do something like this? We need replace string "domainame.de" to "domainname.com" - everywhere.
What you want to do sounds dangerous, as it could hit some false-positives, and change things unintentionally. Suppose your old domain is 'acme.de' and the new one 'acme.com', and some random visitor posted the following (this is an over-simplified example):
I enjoy working with Acme.Depending on my mood.
It would be very easy to convert this to:
I enjoy working with Acme.compending on my mood.
Therefore, my suggestions, in order of preference:
Don't update the DB at all, just configure your web server to redirect the .de traffic to the .com traffic. You're less likely to make mistakes this way.
If you must update the discussion board, do it in your display logic, rather than in the database--then you'll have no chance of making irrevocable mistakes.
Write a script in perl, or your favorite text-processing language, language, which does a regex replacement on every table/field. I suggest the following strategy:
a. Do a SELECT id,<field name> FROM <table> WHERE <field name> LIKE '%domain.de%'
b. Store output in a CSV, or other format that is easy to parse.
c. Run your Regex script to change domain.de to domain.com
d. Check the output.
e. Do an UPDATE <table> SET <field>=? WHERE id=?, with the output of your script.
Do it in small chunks at first (a few tens or hundreds of posts at a time), and visually check the results before committing your changes to the database, to make sure you haven't made mistakes.
I dont know whether this might work for you but have a look at this
The following query would give you the list of tables (120 tables)
SELECT DISTINCT table_name
FROM
(
SELECT *
FROM information_schema.`COLUMNS` C
) t1
WHERE TABLE_SCHEMA='schema_name'
next
you can use UPDATE query for each table. you can achieve this using CURSORS
I am not good in cursors but I think it will help in this situation

Create Directory for records in MS Access 2007

Is it possible to create a directory folder for individual records in Access 2007. For example
tblUser
ID
firstName
surName
When adding a record, would create a folder C:\userdatabase\Surname,firstName,ID
Could see this being useful in situations for example where a large amount of images/files would need to be associated with a record. Access would create and link to a directory for each record.
Thanks in advance for any advice
Noel
You can use the VBA MkDir statement to make a directory.
For example if you want to create a folder whose name matches one of your ID values, as a sub folder under the directory where your database is stored, you could use this code:
MkDir CurrentProject.Path & "\" & ID
To create the entire directory structure with one command:
link text
While these are all interesting answers to the question asked, I have to wonder why the original poster thinks this is necessary. If you're using your database to keep track of the information, it shouldn't really matter where the files are stored.
Of course, if you need to have access to the files from the file system, this can be a way to do it, but in my experience, usually not the most useful way (it segregates the data to too high a degree).
So, I'm basically saying to go back and question whether the design is correct or not. It very well may be, but you should be certain before committing to something like this, which I consider to be unnecessarily convoluted.

Database design: Keeping track of tag changes between revisions

I'm building a revision system similar to the one Stack Overflow has and there's one thing I can't get my head around, what's the best way to the differences in tags between multiple revisions?
The simplest way I can think of is we have 3 tables, revisions, tags and another to link the two.
Each revision then has its own set of tags, the only problem is that when you want to display all revisions, the tags need to be re-compared to find out the differences even though they don't change.
Perhaps an extra field or two could be added to mark tags which have been added or removed from the previous revision.
Is there a better way of doing this?
Do not overcomplicate your schema and do not optimize prematurely. Pair-wise comparison of revision tags is a very cheap operation (provided you have all data in memory) and it can be done while prepararing view model.
I'd say you're on the right track
T1: Revisions
|Item ID|revision ID|more...|
T2: Tags
|Tag ID|Tag fields...|
T3: Tags Per Revision
|Item ID|revision ID|Tag ID| /* This will have multiple rows, 1 per tag) */
To find tag diffs, simply retrieve tags for last 2 revisions and compare using your favorite hashmaps in whatever language you have, or however else your language can implement set differences efficiently.