Merge firefox bookmarks - json

I have two separate computers on which i have a separate set of bookmarks in firefox.
I want to merge the two so that i have access to all the links at a time.
Is there any utility to help me with this.
I can get the two bookmark files (.json - preferred, .html) and try to create a single bookmark file by parsing them. But, i want to be sure that there are no errors and i also want to remove duplicates from the resultant file.
Any pointers would be appreciated. Thanks a lot.

Export bookmarks in HTML then import the bookmarks-date.html is the simpliest and fastest way to merge a given bookmarks set.
Especially as Firefox supports export/import tags and annotations starting with version 43. This allows to export/import any bookmarks' folder(s) you wanna keep, in place of replacing the whole lot, finally :)

Take a look at Firefox Sync. It is a way to keep your bookmarks, history, preferences, passwords, etc. synced across multiple devices. Also, it comes standard with Firefox; you don't even have to install an Add-on to use it.

You can export your bookmarks or just look them up in your profile folder.
I think the easiest way to merge two bookmarks files is importing one profile to the other firefox (and eventually exporting the merged bookmarks again). It does not need any (manual) parsing and should not produce any errors.

The solution I found the easiest is to download a different version of Firefox (in my case Firefox Nightly) which I don't use and use it as the host for the new bookmark list. I exported the bookmarks from both machines in HTML format, naming them differently. The plugin which I used was - Bookmark Dupes by Martin Väth.
Just import both HTML bookmark files, then use Bookmark Dupes to first delete all duplicates and then delete all empty folders. You will be then left with a duplicate folder structure which has bookmarks in one but not the other, just move the bookmarks up to one folder and then delete empty folders when you're done.

Related

Mercurial -- Ignore certain files based on the existence of other files

I use mercurial to keep track of a repository which contains both PDF files (generated by others, which I need to keep track of), and latex files, written by me.
For instance, assume a directory structure like this:
root
- Requirements.pdf
- MyReport.tex
- MyReport.pdf
In this case, MyReport.pdf changes every time MyReport.tex does, and can be wholly determined by the contents of the tex file, so it should not be under version control.
I am looking for a way to tell mercurial to ignore such files. Obviously I can add a rule to .hgignore like this (http://www.selenic.com/mercurial/hgignore.5.html)
syntax: glob
*.pdf
But that will ignore the PDFs that I do need to keep version controlled.
There's also this link: https://www.mercurial-scm.org/wiki/TipsAndTricks#Avoid_merging_autogenerated_.28binary.29_files_.28PDF.29 but that doesn't really solve my problem either, because while it handles building the PDFs, it does not handle telling hg which files are important.
Or I could just do this manually, but I would like a way to script it, to make it more general, since these repositories can have several dozen tex and pdf files and manually managing this has become cumbersome.
It seems like quite a simple rule: If there is a file by the name of "blah.pdf", check to see if there is also a file name "blah.tex" and if so, ignore it, otherwise, pay attention to it. But I can't find anything about that.
There is no such feature in Mercurial, nor in Git, nor will there likely ever be such a feature because it's extremely niche. However, you might consider simply putting your "generated" files into a separate output subdirectory, and then ignoring all such directories. For example, if you have an input like foo/bar.tex, the output could be foo/gen/bar.tex, and you could ignore gen/.
Obviously I can add a rule to .hgignore like this
(http://www.selenic.com/mercurial/hgignore.5.html) ... But that will
ignore the PDFs that I do need to keep version controlled.
.hgignore ignore all newly added or existing not versioned files, matching pattern, but bolded texts give you at least two usable solutions:
Write regexp, which means "all pdf, except some filename(s)" (with manually added filenames, most probably)
use wide pattern, but add needed files into repository explicitly (hg add FILENAME)

Sharing files between Mercurial repositories

There are one or two files, like .hgignore, which I generally want to be the same in each of a bunch of projects.
However, the nature of these files means that I can't simply move them to a common shared project and just make the other projects depend on that project. They have to be inside each project. Symbolic links are not an option either because some of our developers use Windows.
How can I share these files between repositories and have changes propagated across (on my local machine, at least)? I'm using Eclipse.
For your specific case of hgignore you can put an entry like this in each project's .hg/hgrc file:
[ui]
ignore.common = ~/hgignore-common
If you you know your common library will always the in the parent directory, as is often the case with a subrepo setup you could do:
[ui]
ignore.common = ../hgignore-common
or if you know it will always be in a sibling directory of project checkouts you could do:
[ui]
ignore.common = ../company-wide-defaults/hgignore-common
Unforunately there's no absolute way to reference a file that's valid everywhere, but you can at least to to a point where on your machine all your checkouts are referencing a common ignore.
Hardlinking instead of copying the relevant files sort of works with Eclipse - although you have to refresh each of the other projects to get it to pick up the change. However, you can configure Eclipse to watch the filesystem and automatically refresh whenever it needs to - I recommend this.
It does not work by default with Emacs, because Emacs breaks hard links (which is normally the right thing to do, but is not what you want in this case). However, you can disable this behaviour for multiply-linked files with (setq backup-by-copying-when-linked t).

How can I revert a single file to a version I committed in Mercurial?

I have my index.cshtml file and I made a ton of changes to it. However, I want to scrap it and return to the a working (commited) version of this single file.
How can I use Mercurial to accomplish this?
I'm using Visual Studio 2011 with VisualHG.
The command is called hg revert, you should be able to find something like that in VisualHg.
It looks like you already know what the command is named (since you used it as a tag). Is it not available in VisualHg? I would guess it's available in the context menu (i.e. right click) for the file.
Right-click on the file you want to revert and select "Revert Changes", this will show the revert window where you can see the file diff and perform the reversion by clicking the "Revert" button in the botom right corner.
Most of the times, when you make a lot of modifications to a file, you may find out that some of them are useful ( I do, at least ). Of course, for reverting the whole contents of the file, you should use revert as others have suggested. If however, you think you may have something useful in your current modifications, that you'd like to keep, consider using the record extension. It's an extension that ships with Mercurial, and it will allow you to choose whether or not you want to include some (c)hunks in your next commit.

Ask or alert the user that she is changing a specific file, which we seldom want to change (but still want in our version control)

We have an XML file which contains the settings of a tool we use. The tool is nice, but if you change some settings when using it it's quite easy to save those settings to the XML-file by mistake (you get a question, but it's easy to answer yes).
Is there a way to alert the user someway that she is commiting a change to this specific file? We want it versioned, but we also want centralized and we want the settings to be quite stable.
It's a file versioned in Windows on an NTFS partition, if that matters. Trying to set the file to "read only" doesn't seem to work (after I set it, hg st still says no changes). Any ideas?
The way this is usually handled is to put that file in your .hgignore and to not version it. Instead, you should version a template file. i.e., config.xml.template.
That way, the only way changes will get committed to it is for someone to consciously bring those changes into the template.
If you really want to catch it during commit, you'll need to write some hooks and get your users to install those locally.

Mercurial: Editor doesn't show the conflict file after a conflicted merge

After having solved the problem of getting the editor to launch when there's a merge conflict - Mercurial: No editor appears when merge conflicts are detected
I now have another problem, the editor now launches but opens the files in the following order:
hello.c
hello.c~base.????
hello.c~other.????
But what I really want to see is the file that highlights the conflicts, which I expect should be the first one hello.c, but instead hello.c just shows the tip.
Any advice?
Regards,
Chris
I'm not sure what tool you're using for merges, but it sounds like it's doing a 3-way merge. The left pane is normally the common ancestor, the middle pane is the file you're merging in, and the right pane is your changes to the file.
I really like kdiff3 (free and open source) for merges and would recommend it if the tool that you're using isn't working for you. It's in the mercurial documentation as the example merger that they use in many places.
The first file ends up being the finished merge, so you need to make sure you manually copy in all changes from the other two files. Vimdiff works well for this as it highlights all differences between the three files. I'm not exactly sure how the three files are generated, but this process does seem to work for me.