.hgignore not working for me - mercurial

I'm trying to setup .hgignore for a project. The .hgignore file is in the project root next to the .hg file. The output from a status is below, I'd like to ignore all files in the sdcard.cydsn\ARM_GCC_441\Debug and sdcard.cydsn\codegentemp directories. I've tried various combinations of forward/back slashes and wildcards but can't get it to work. Any suggestions?
C:\sdcard>hg st
M sdcard.cydsn\ARM_GCC_441\Debug\Clock_1.lst
M sdcard.cydsn\ARM_GCC_441\Debug\Clock_2.lst
M sdcard.cydsn\ARM_GCC_441\Debug\Cm3Start.lst
M sdcard.cydsn\ARM_GCC_441\Debug\Control_Reg_1.lst
M sdcard.cydsn\ARM_GCC_441\Debug\CyDmac.lst
M sdcard.cydsn\ARM_GCC_441\Debug\CyFlash.lst
M sdcard.cydsn\ARM_GCC_441\Debug\CyLib.lst
M sdcard.cydsn\ARM_GCC_441\Debug\CySpc.lst
M sdcard.cydsn\ARM_GCC_441\Debug\SPIM_1.lst
M sdcard.cydsn\ARM_GCC_441\Debug\SPIM_1_INT.lst
M sdcard.cydsn\ARM_GCC_441\Debug\SPIM_1_PM.lst
M sdcard.cydsn\ARM_GCC_441\Debug\TX.lst
M sdcard.cydsn\ARM_GCC_441\Debug\UART_1.lst
M sdcard.cydsn\ARM_GCC_441\Debug\UART_1_INT.lst
M sdcard.cydsn\ARM_GCC_441\Debug\UART_1_PM.lst
M sdcard.cydsn\ARM_GCC_441\Debug\clk.lst
M sdcard.cydsn\ARM_GCC_441\Debug\core_cm3.lst
M sdcard.cydsn\ARM_GCC_441\Debug\cyPm.lst
M sdcard.cydsn\ARM_GCC_441\Debug\cyfitter_cfg.lst
M sdcard.cydsn\ARM_GCC_441\Debug\cyutils.lst
M sdcard.cydsn\ARM_GCC_441\Debug\ff.lst
M sdcard.cydsn\ARM_GCC_441\Debug\main.lst
M sdcard.cydsn\ARM_GCC_441\Debug\miso.lst
M sdcard.cydsn\ARM_GCC_441\Debug\mmc.lst
M sdcard.cydsn\ARM_GCC_441\Debug\mosi.lst
M sdcard.cydsn\ARM_GCC_441\Debug\sdcard.a
M sdcard.cydsn\ARM_GCC_441\Debug\ss.lst
M sdcard.cydsn\codegentemp\lcpsoc3\index
M sdcard.cydsn\codegentemp\sdcard.ctl
M sdcard.cydsn\codegentemp\sdcard.cyfit
M sdcard.cydsn\codegentemp\sdcard.rpt
M sdcard.cydsn\codegentemp\sdcard.v
M sdcard.cydsn\codegentemp\sdcard.vh2
M sdcard.cydsn\codegentemp\sdcard_timing.xml
M sdcard.cydsn\sdcard.cyfit
M sdcard.cydsn\sdcard.cyprj
M sdcard.cydsn\sdcard.cyprj.sean
M sdcard.cydsn\sdcard.rpt
M sdcard.cywrk
M sdcard.cywrk.sean
? .hgignore

If you are already tracking the files, which you are, after you do a
hg add .hgignore
you will need to forget the files that you don't want to track anymore. .hgignore doesn't get ignore files you are already tracking.

You need to add the ignore file to your repository. ie:
hg add .hgignore
The ignore file is versioned like any other file, it's just that the hg tools attach special meaning to its contents.

Related

Alembic: how to downgrade an entire branch?

Say this is my graph of alembic versions:
a -> b -> c -> d
\> e -> f
i'm interested in rolling back e and f but not c and d
so the issue is:
alembic downgrade takes an argument that represents the target revision (rather than the revision to be rolled back)
alembic downgrade e will correctly downgrade from f to e
alembic downgrade -1, so far as I can tell, can technically roll back the head of either branch.
I can't seem to do alembic downgrade b to roll back e and f without also rolling back c and d
Is the thing I'm trying to do possible with alembic?
UPDATE: It turns out this has been an open issue since 2017.
https://github.com/sqlalchemy/alembic/issues/464
My solution, for posterity, is to make a new revision g that will undo the changes in e and f so I basically get to work from the state of b.

Generating a list of directories containing files changed between revisions

I know from this answer that I can do
hg status --rev x:y
to list files that have been changed between revisions x and y. Is there a way to get not the indiviual files but only the directories in which they are contained?
For example if the above command would yield
A Foo\Bar\SomeFile.txt
A Foo\Bar\AnotherFile.cs
M Baz\AnotherFile.txt
I want to get
Foo\Bar
Baz
instead.
Not a ready-to use solution (see end-notes), just hints
You can use templates for changing output format of hg st, as it can done for any "log-like" hg commands (see -T option)
in template you can filter output (filenames) with filter "dirname", which'll strip filename part of file
but I tried it and discovered (on my repos) some "oddities" (and expected troubles)
End-notes:
While default output of hg st eliminates duplicate filenames (if they appear) in result, your template will not (again, "by default")
I saw wrong (totally wrong) result of templated output for the same range of status
good
>hg st --rev 1170:tip
M hggit\__init__.py
M hggit\compat.py
M hggit\git_handler.py
M hggit\gitdirstate.py
M hggit\hg2git.py
M tests\test-illegal-contents.t
my
>hg st --rev 1170:tip --template "{files % '{file}\n'}"
hggit/__init__.py
hggit/__init__.py
hggit/__init__.py
hggit/__init__.py
hggit/__init__.py
hggit/__init__.py
(six times files from tip only instead of range)
Even with hg log -T instead of st (which give all files) you'll have problem from p.1: "more than one file-entry in output for the same file"

Mercurial: Hg Status - Do you know how to report file name only (no path) on Windows OS?

When I run Hg status I get a listing something like the following:
M proj\Content\Site.css
M proj\Views\DoThing\DoThing.cshtml
M proj\Views\MainThing\MainThing.cshtml
M proj\Views\GetThing\GetThing.cshtml
M proj\Views\ViewThing\Index.cshtml
M proj\Views\Home\Index.cshtml
M proj\Views\Shared\_Layout.cshtml
M proj\js\extra.js
Does anyone know how to run hg status and easily get just the filnames to be listed -- sans the path info? Something like:
M Site.css
M DoThing.cshtml
M MainThing.cshtml
M GetThing.cshtml
M Index.cshtml
M Index.cshtml
M _Layout.cshtml
M extra.js
Or, if you have some quick way of piping this through some command-line thing like findstr or something which will easily and quickly strip off the path, let me know.
I need the final format shown. Anyone? Anyone?
If you have Mercurial 3.5 installed (i.e. the most recent version as of the time of this writing), you can use the experimental status templates. Use hg help status -v to see if there's a --template option. If so, use:
hg status -T '{status} {path|basename}\n{if(copy, " {copy}\n")}'
This is the normal status output, except that {path} has been replaced with {path|basename}.
If you can use sed
Extract the file path and replace with file name
hg status | sed "s/ .*\\\(.*\)\.\(.*\)/ \1.\2/

How to find (latest) descendant revision of given ( possibly renamed ) file

Assuming a hg repository with arbitrary changes incl file renames/copies.
Some time in the past I picked an arbitrary file revision from repo and noted down it’s changeset/revision :
File A revision 2 changed with changeset aaabbbccceeefffggg
I now ( after several possible committed changes ) want to know which current file in my repo is descendant of the original noted file/revision.
For example the following file history ( incl. renames of A ) :
C tip ( renamed from B rev 7 )
B 7
B 6
B 5
B 4 ( renamed from A rev 3 )
A 3
A 2
A 1
Starting point of my problem is file A revision 2.
How do I traverse to C ( find out the path C and get revision of C too ) ?
Problem is hat A is currently not visible at all in my repo ( because it was renamed to something else ) :
hg log --follow A
abort: cannot follow file not in parent revision: "A"
Somehow I need a reversed “--follow”, i.e. going up the version history (future) instead of down (past).
Update to revision 2 and than call the log --follow command.
I did not tried it, but the message "cannot follow file not in parent revision" suggests that the file should be in the parent of the working directory.

revision errors in feauture branches while converting from cvs to mercurial

We are converting the cvs repository which has two branches (one is the MAIN and the other is the FEATURE,rest all can be ignored) into a mercurial repository.
We are using the inbuilt tool convert with the following command.
hg convert cvs_source_dir hg_new
where cvs_source_dir = Updated Directory with only Feauture branch changes from CVS.
hg_new= new name of mercurial repository .
After converting ,the hg_new repo has all History data from CVS.
when we did an hg update it points to MAIN branch code .
And if we update it to FEATURE to get the code from FEAUTURE branch as per CVS , by using
hg update FEAUTURE , all the files which dont have a revision in the FEAUTURE branch is getting deleted.
How can this be solved?
If I understand correctly, branch FEATURE doesn't have some files that exist in branch MAIN, so when you hg up to branch FEATURE, these files are missing.
I think it is a feature that hg up brings your working directory into the status when you committed (-c will check the uncommitted changes), so the files that do not exist in branch FEATURE will gone.
This post shows a method to get the file you want from another branch. If you have a list of files, iterate the list and get every file to your current working directory.
[Updated]
A graph to show how to make it right:
(1) your current status
A -- B -- C -- D (MAIN)
\
- E -- F -- G (FEATURE, missing files)
(2) step 1:
A -- B -- C -- D (MAIN)
\
- E -- F -- G (FEATURE, missing files)
\
-H (FEATURE, a head adding all missing files from A)
(3) step 2:
A -- B -- C -- D (MAIN)
\
- H - (rebase) - E' -- F' -- G' (FEATURE, missing files)