Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use `hg cat` from an empty working directory?

Tags:

mercurial

I have a repo located at x:/projects/repo1. The working directory has been emptied using hg update null. I want to extract the latest version of some files from there to a local directory.

I tried this:

x:\projects\repo1> hg cat -o c:\sql\%s scripts\*.sql -r tip

I get this error:

scripts\*.sql: No such file in rev 14f07c26178b

The same command works fine if the working directory is not empty. Is there a good reason why this does not work? Or do you know another way of extract some files from there to a local directory?

like image 356
Sylvain Avatar asked Jul 23 '10 20:07

Sylvain


People also ask

How to remove files from hg?

' hg forget ' is just shorthand for ' hg remove -Af '. From the ' hg remove ' help: ...and -Af can be used to remove files from the next revision without deleting them from the working directory. Bottom line: ' remove ' deletes the file from your working copy on disk (unless you uses -Af ) and ' forget ' doesn't.

How do you Untrack a file in Heartgold?

If you see the help for hg rm --help : hg remove [OPTION]... FILE... Schedule the indicated files for removal from the current branch. This command schedules the files to be removed at the next commit.


2 Answers

The hg cat command is for single files. If you want multiple files use the hg archive command, which makes zipfiles or directories full of files. Here's your command:

x:\projects\repo1> hg archive --include scripts\*.sql -r tip c:\sql
like image 98
Ry4an Brase Avatar answered Sep 22 '22 01:09

Ry4an Brase


It seems that hg cat doesn't support wildcard symbols in paths. So you should use the full file name:

hg cat -r tip scripts/foo.sql

When your working copy is up to date with the tip revision, your shell does wildcard substitution for you.

The hg manifest command also might be helpful for getting tracked file listings.

like image 43
Andrey Vlasovskikh Avatar answered Sep 20 '22 01:09

Andrey Vlasovskikh