ZyX_I avatar ZyX_I committed 54238c7

@aurum: Made :AuJunk use untracked files if “ignore” option was specified
tests: Added git :AuJunk ignore and ignoreglob tests

Comments (0)

Files changed (5)

 This plugin provides a vim <--> VCS (currently mercurial and git) integration 
 for your projects. Features:
 
-  - Partially committing changes ([:AuRecord](http://vimpluginloader.sourceforge.net/doc/aurum.txt.html#line349-0)).
+  - Partially committing changes ([:AuRecord](http://vimpluginloader.sourceforge.net/doc/aurum.txt.html#line350-0)).
 
-  - Viewing file state at particular revision ([aurum://file](http://vimpluginloader.sourceforge.net/doc/aurum.txt.html#line580-0), [:AuFile](http://vimpluginloader.sourceforge.net/doc/aurum.txt.html#line155-0)).
+  - Viewing file state at particular revision ([aurum://file](http://vimpluginloader.sourceforge.net/doc/aurum.txt.html#line581-0), [:AuFile](http://vimpluginloader.sourceforge.net/doc/aurum.txt.html#line155-0)).
 
   - Viewing uncommited changes in a vimdiff, as well as changes between 
-    specific revisions ([:AuVimDiff](http://vimpluginloader.sourceforge.net/doc/aurum.txt.html#line389-0)). It is also possible to open multiple 
+    specific revisions ([:AuVimDiff](http://vimpluginloader.sourceforge.net/doc/aurum.txt.html#line390-0)). It is also possible to open multiple 
     tabs with all changes to all files viewed as side-by-side diffs.
 
-  - Viewing revisions log ([:AuLog](http://vimpluginloader.sourceforge.net/doc/aurum.txt.html#line235-0)). Output is highly customizable.
+  - Viewing revisions log ([:AuLog](http://vimpluginloader.sourceforge.net/doc/aurum.txt.html#line236-0)). Output is highly customizable.
 
-  - Viewing working directory status ([:AuStatus](http://vimpluginloader.sourceforge.net/doc/aurum.txt.html#line353-0)).
+  - Viewing working directory status ([:AuStatus](http://vimpluginloader.sourceforge.net/doc/aurum.txt.html#line354-0)).
 
   - Commiting changes ([:AuCommit](http://vimpluginloader.sourceforge.net/doc/aurum.txt.html#line96-0)), commit messages are remembered in case of 
-    rollback ([g:aurum_remembermsg](http://vimpluginloader.sourceforge.net/doc/aurum.txt.html#line825-0)).
+    rollback ([g:aurum_remembermsg](http://vimpluginloader.sourceforge.net/doc/aurum.txt.html#line826-0)).
 
   - Obtaining various URL’s out of remote repository URL (like URL of the HTML 
     version of the current file with URL fragment pointing to the current line 
     attached: useful for sharing) ([:AuHyperlink](http://vimpluginloader.sourceforge.net/doc/aurum.txt.html#line186-0)).
 
-  - [aurum#changeset()](http://vimpluginloader.sourceforge.net/doc/aurum.txt.html#line437-0), [aurum#repository()](http://vimpluginloader.sourceforge.net/doc/aurum.txt.html#line433-0) and [aurum#status()](http://vimpluginloader.sourceforge.net/doc/aurum.txt.html#line441-0) functions 
+  - [aurum#changeset()](http://vimpluginloader.sourceforge.net/doc/aurum.txt.html#line438-0), [aurum#repository()](http://vimpluginloader.sourceforge.net/doc/aurum.txt.html#line434-0) and [aurum#status()](http://vimpluginloader.sourceforge.net/doc/aurum.txt.html#line442-0) functions 
     that are to be used from modeline.
 
   - Frontends for various other VCS commands.
 
-Most commands can be reached with a set of mappings (see [aurum-mappings](http://vimpluginloader.sourceforge.net/doc/aurum.txt.html#line722-0)), 
+Most commands can be reached with a set of mappings (see [aurum-mappings](http://vimpluginloader.sourceforge.net/doc/aurum.txt.html#line723-0)), 
 all mappings are customizable.
 
 
     (specify “:” to act on current file). With “ignoreglobs” it will ignore 
     not matching files, but given globs. Unlike other commands you must 
     specify at least one glob (or “:”) here, without this it will fail.
+    Note: It won’t touch untracked files unless “ignore” option was specified.
 
 AuLog [{repo}] {options} {diffoptions}                                *:AuLog*
     Open buffer with changeset log. For {diffoptions} see |aurum-diffoptions|.
             \            },
         \}
 "▶1 getexsttrckdfiles
-function s:F.getexsttrckdfiles(repo)
+function s:F.getexsttrckdfiles(repo, ...)
     let cs=a:repo.functions.getwork(a:repo)
     let r=copy(a:repo.functions.getcsprop(a:repo, cs, 'allfiles'))
     let status=a:repo.functions.status(a:repo)
     call filter(r, 'index(status.removed, v:val)==-1 && '.
                 \  'index(status.deleted, v:val)==-1')
     let r+=status.added
+    if a:0 && a:1
+        let r+=status.unknown
+    endif
     return r
 endfunction
 "▶1 getaddedermvdfiles
     endif
     let repo=s:_r.repo.get(a:1)
     call s:_r.cmdutils.checkrepo(repo)
-    let allfiles=s:F.getexsttrckdfiles(repo)
+    let forget=get(a:opts, 'forget',      0)
+    let ignore=get(a:opts, 'ignore',      0)
+    let igglob=get(a:opts, 'ignoreglobs', 0)
+    let remove=get(a:opts, 'remove',      !(forget || ignore || igglob))
+    let allfiles=s:F.getexsttrckdfiles(repo, ignore)
     let globs=filter(copy(a:000), 'v:val isnot# ":"')
     let hascur=(len(globs)!=a:0)
     let files=s:F.filterfiles(repo, globs, allfiles)
         let files+=[repo.functions.reltorepo(repo,
                     \s:_r.cmdutils.getrrf(rrfopts, 'nocurf', -1)[3])]
     endif
-    let forget=get(a:opts, 'forget',      0)
-    let ignore=get(a:opts, 'ignore',      0)
-    let igglob=get(a:opts, 'ignoreglobs', 0)
-    let remove=get(a:opts, 'remove',      !(forget || ignore || igglob))
     for key in filter(['forget', 'remove', 'ignore'], 'eval(v:val)')
         call map(copy(files), 'repo.functions[key](repo, v:val)')
     endfor
     if igglob
-        call map(copy(globs), 'repo.functions.ignoreglob(repo, v:val)')
+        call map(copy(globs), 'repo.functions.ignoreglob(repo, '.
+                    \         'repo.functions.reltorepo(repo, v:val))')
     endif
 endfunction
 let s:junkfunc['@FWC']=['-onlystrings '.
 :/Commited/delete _
 :Run! echo
 :bwipeout!
-:W{{{1 Track: forget, remove
+:W{{{1 Junk: forget, remove
 :call WriteFile(filereadable('./gittestrepo/-f').filereadable('./gittestrepo/--force'))
 :AuJunk forget ./gittestrepo/-f
 :AuJunk remove ./gittestrepo/--force
 :AuGrep W revision HEAD^^^^ repo ./gittestrepo/ | cwindow
 :call WriteFile(map(getline(1, '$'), 'substitute(v:val, "'.cs.hex.'", "HEAD^^^^", "g")'))
 :cclose
+:W{{{1 Junk: ignore, ignoreglob
+:write! ./gittestrepo/file.vim
+:write! ./gittestrepo/subdir/file.vim
+:write! ./gittestrepo/ignoredfile.vim
+:W{{{2 Status before junk
+:Run! AuStatus ./gittestrepo/
+:AuJunk ignore ./gittestrepo/file.vim
+:AuJunk ignoreglob ./gittestrepo/ignored*
+:W{{{2 Status after junk
+:Run! AuStatus ./gittestrepo/
+:W{{{2 gitignore contents
+:call WriteFile(readfile('./gittestrepo/.gitignore', 'b'))

Binary file modified.

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.