[PATCH] subrepo: add status support for ignored files in git subrepos
Augie Fackler
raf at durin42.com
Sat Nov 29 03:08:02 UTC 2014
On Nov 28, 2014, at 2:57 PM, Mathias De Maré <mathias.demare at gmail.com> wrote:
> # HG changeset patch
> # User Mathias De Maré <mathias.demare at gmail.com>
> # Date 1417202175 -3600
> # Fre Nov 28 20:16:15 2014 +0100
> # Node ID 38f8516fa91a71df42bf2ca5a7e20e54b540f590
> # Parent b913c394386f0a6ebbdcb7e321ff82816d7799fe
> subrepo: add status support for ignored files in git subrepos
Queued, many thanks. Congrats on your first patch to Mercurial!
>
> Retrieving the status of a git subrepo did not show ignored
> files. Using 'git ls-files', we can retrieve these files
> and display the correct status.
>
> diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py
> --- a/mercurial/subrepo.py
> +++ b/mercurial/subrepo.py
> @@ -1565,16 +1565,25 @@ class gitsubrepo(abstractsubrepo):
> if status == 'M':
> modified.append(f)
> elif status == 'A':
> added.append(f)
> elif status == 'D':
> removed.append(f)
>
> deleted, unknown, ignored, clean = [], [], [], []
> +
> + if not rev2:
> + command = ['ls-files', '--others', '--exclude-standard']
> + out = self._gitcommand(command)
> + for line in out.split('\n'):
> + if len(line) == 0:
> + continue
> + unknown.append(line)
> +
> return scmutil.status(modified, added, removed, deleted,
> unknown, ignored, clean)
>
> def shortid(self, revid):
> return revid[:7]
>
> types = {
> 'hg': hgsubrepo,
> diff --git a/tests/test-subrepo-git.t b/tests/test-subrepo-git.t
> --- a/tests/test-subrepo-git.t
> +++ b/tests/test-subrepo-git.t
> @@ -114,17 +114,20 @@ clone root separately, make different lo
>
> $ cd ../t
> $ hg clone . ../tb 2> /dev/null
> updating to branch default
> cloning subrepo s from $TESTTMP/gitroot
> 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
>
> $ cd ../tb/s
> + $ hg status --subrepos
> $ echo f > f
> + $ hg status --subrepos
> + ? s/f
> $ git add f
> $ cd ..
>
> $ hg status --subrepos
> A s/f
> $ hg commit --subrepos -m f
> committing subrepository s
> $ hg debugsub
> @@ -417,24 +420,27 @@ Check hg update --clean
> $ cd s
> $ echo c1 > f1
> $ echo c1 > f2
> $ git add f1
> $ cd ..
> $ hg status -S
> M s/g
> A s/f1
> + ? s/f2
> $ ls s
> f
> f1
> f2
> g
> $ hg update --clean
> 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
> $ hg status -S
> + ? s/f1
> + ? s/f2
> $ ls s
> f
> f1
> f2
> g
>
> Sticky subrepositories, no changes
> $ cd $TESTTMP/ta
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-devel/attachments/20141128/de660272/attachment.asc>
More information about the Mercurial-devel
mailing list