explicit move/copy dialog in add; update changelog

main
Fabien C. Y. Benureau 5 years ago
parent 54facc4085
commit d11f443276
No known key found for this signature in database
GPG Key ID: C3FB5E831A249A9A

@ -7,12 +7,17 @@
### Implemented enhancements
- Added support for non-standard bibtex types, e.g. @collection, @software, etc. ([#226](https://github.com/pubs/pubs/pull/226)
- The number of displayed authors in listings is now configurable, as the `max_authors` value in the `main` section of the configuration. ([#225](https://github.com/pubs/pubs/pull/225)
- Added support for non-standard bibtex types, e.g. @collection, @software, etc. ([#226](https://github.com/pubs/pubs/pull/226))
- The number of displayed authors in listings is now configurable, as the `max_authors` value in the `main` section of the configuration. ([#225](https://github.com/pubs/pubs/pull/225))
- More explicit add command dialogs when copying and moving documents.
- Empty tags are not added to papers anymore.
### Fixed bugs
- Tests don't run on python 2.7 or <=3.4. They may still work, but support will not be tested and will eventually be dropped. ([#223](https://github.com/pubs/pubs/pull/223)
- Tests don't run on python 2.7 or <=3.4. They may still work, but support will not be tested and will eventually be dropped. ([#223](https://github.com/pubs/pubs/pull/223))
- Fixed the reported number of paper with a tag in the statistic command ([#232](https://github.com/pubs/pubs/pull/232) by [beuerle](https://github.com/beuerle))
- Fixed a crash when resolving citekeys introduced by [#225](https://github.com/pubs/pubs/pull/225) ([#233](https://github.com/pubs/pubs/pull/233) by [beuerle](https://github.com/beuerle))
## [v0.8.3](https://github.com/pubs/pubs/compare/v0.8.2...v0.8.3) (2019-08-12)
@ -44,7 +49,6 @@ A hotfix release. All users of 0.8.0 are urged to upgrade.
### Fixed bugs
- Fix adding paper with DOIs, ISBNs or arXiv references. [(#165)](https://github.com/pubs/pubs/pull/165)
- Fix statistics command when there is not yet any paper in the repository. [(#164)](https://github.com/pubs/pubs/pull/164)
@ -55,69 +59,39 @@ A long overdue feature release. Add supports for arXiv bibtex fetching, and many
### Implemented enhancements
- Adds `move`, and `link` options for handling of documents during `import` (copy being the default). Makes `copy` the default for document handling during `add`. [(#159)](https://github.com/pubs/pubs/pull/159)
- Support for downloading arXiv reference from their ID ([#146](https://github.com/pubs/pubs/issues/146) by [joe-antognini](https://github.com/joe-antognini))
- Better feedback when an error is encountered while adding a reference from a DOI, ISBN or arXiv ID [#155](https://github.com/pubs/pubs/issues/155)
- Better dialog after editing paper [(#142)](https://github.com/pubs/pubs/issues/142)
- Add a command to open urls ([#139](https://github.com/pubs/pubs/issues/139) by [ksunden](https://github.com/ksunden))
- More robust cache on version change [(#138)](https://github.com/pubs/pubs/issues/138)
- Allow utf8 citekeys [(#133)](https://github.com/pubs/pubs/issues/133)
- Adds tag list completion in `pubs add -t ` [(#130)](https://github.com/pubs/pubs/issues/130)
- Wider Travis coverage ([#107](https://github.com/pubs/pubs/issues/107) and [#108](https://github.com/pubs/pubs/issues/108))
- Uses bibtexparser bwriter instead of internal encoder and adds `--ignore-fields` option to export. [(#106)](https://github.com/pubs/pubs/issues/106)
- Configurable alias descriptions ([#104](https://github.com/pubs/pubs/issues/104) by [wflynny](https://github.com/wflynny))
- Support year ranges in query [(#102)](https://github.com/pubs/pubs/issues/102)
- Tests can now be run with `python setup.py test` [#155](https://github.com/pubs/pubs/issues/155)
### Fixed bugs
- [[#144]](https://github.com/pubs/pubs/issues/144) More robust handling of the `doc_add` options [(#159)](https://github.com/pubs/pubs/pull/159)
- [[#149]](https://github.com/pubs/pubs/issues/149) More robust handling of parsing and citekey errors [(#87)](https://github.com/pubs/pubs/pull/87)
- [[#148]](https://github.com/pubs/pubs/issues/148) Fix compatibility with Pyfakefs 3.7 [(#151)](https://github.com/pubs/pubs/pull/151)
- [[#95]](https://github.com/pubs/pubs/issues/95) Error message when editor is missing [(#141)](https://github.com/pubs/pubs/issues/141)
- Fixes tests for printing help on `--help` and without argument. [(#137)](https://github.com/pubs/pubs/issues/137)
- [[#126]](https://github.com/pubs/pubs/issues/126) Removes journal customization [(#127)](https://github.com/pubs/pubs/issues/127)
- Fixes Travis failure on installing python3 for OSX [(#125)](https://github.com/pubs/pubs/issues/125)
- [[#119]](https://github.com/pubs/pubs/issues/119) Removes link and DOI customization. [(#124)](https://github.com/pubs/pubs/issues/124)
- [[#122]](https://github.com/pubs/pubs/issues/122) Fixes common strings [(#123)](https://github.com/pubs/pubs/issues/123)
- [[#28]](https://github.com/pubs/pubs/issues/28) allow utf8 in citekeys [(#120)](https://github.com/pubs/pubs/issues/120)
- Fixes field orders to use 'url' and fixes broken test. [(#118)](https://github.com/pubs/pubs/issues/118)
- [[#25]](https://github.com/pubs/pubs/issues/25) Fix bibtex testcase [(#117)](https://github.com/pubs/pubs/issues/117)
- [[#103]](https://github.com/pubs/pubs/issues/103) Fixes unicode comparison [(#116)](https://github.com/pubs/pubs/issues/116)
- [[#95]](https://github.com/pubs/pubs/issues/95) robust handling of DOIs ([#105](https://github.com/pubs/pubs/issues/105) by [wflynny](https://github.com/wflynny))
- [[#99]](https://github.com/pubs/pubs/issues/99) Print help when no subcommand is provided ([#100](https://github.com/pubs/pubs/issues/100) by [wflynny](https://github.com/wflynny))
- Fix defaults not used in config. [(#97)](https://github.com/pubs/pubs/issues/97)
- Fixes content not read from urls because of call to `os.abspath` [(#96)](https://github.com/pubs/pubs/issues/96)
- [[#93]](https://github.com/pubs/pubs/issues/93) actually save the modifications on `edit -m`. [(#94)](https://github.com/pubs/pubs/issues/94)
- [[#88]](https://github.com/pubs/pubs/issues/88) Adds proper escaping for
arguments in alias plugin. [(#91)](https://github.com/pubs/pubs/issues/91)

@ -6,6 +6,7 @@ from .. import p3
from .. import bibstruct
from .. import content
from .. import repo
from .. import color
from .. import paper
from .. import templates
from .. import apis
@ -149,13 +150,15 @@ def command(conf, args):
rp.push_paper(p)
ui.message('added to pubs:\n{}'.format(pretty.paper_oneliner(p, max_authors=conf['main']['max_authors'])))
if docfile is not None:
rp.push_doc(p.citekey, docfile, copy=(doc_add in ('copy', 'move')))
rp.push_doc_paper(p, docfile, copy=(doc_add in ('copy', 'move')))
if doc_add in ('move', 'copy'):
if doc_add == 'move' and content.content_type(docfile) != 'url':
content.remove_file(docfile)
if doc_add == 'move':
ui.message('{} was moved to the pubs repository.'.format(docfile))
elif doc_add == 'copy':
ui.message('{} was copied to the pubs repository.'.format(docfile))
docpath = content.system_path(rp.databroker.real_docpath(p.docpath))
verb = 'moved' if doc_add == 'move' else 'copied'
ui.message('{} was {} to {} inside the pubs repository.'.format(color.dye_out(docfile, 'filepath'), verb,
color.dye_out(docpath, 'filepath')))
rp.close()

@ -92,6 +92,7 @@ def command(conf, args):
if not args.link and args.move:
content.remove_file(document)
# FIXME: coherence with add command, the destination location should be given when copying/moving.
ui.message('{} added to {}'.format(
color.dye_out(document, 'filepath'),
color.dye_out(paper.citekey, 'citekey')))

@ -182,17 +182,22 @@ class Repository(object):
events.RenameEvent(paper, old_citekey).send()
return True
def push_doc(self, citekey, docfile, copy=None):
p = self.pull_paper(citekey)
return self.push_doc_paper(p, docfile, copy=copy)
def push_doc_paper(self, paper, docfile, copy=None):
"""Same as push_doc, only the Paper instance is provided rather than the citekey"""
if copy is None:
copy = self.conf['main']['doc_add'] in ('copy', 'move')
if copy:
docfile = self.databroker.add_doc(citekey, docfile)
docfile = self.databroker.add_doc(paper.citekey, docfile)
else:
docfile = system_path(docfile)
p.docpath = docfile
self.push_paper(p, overwrite=True, event=False)
events.DocAddEvent(citekey).send()
paper.docpath = docfile
self.push_paper(paper, overwrite=True, event=False)
events.DocAddEvent(paper.citekey).send()
def unique_citekey(self, base_key, bibentry):
"""Create a unique citekey for a given base key.

@ -183,3 +183,4 @@ You can access the self-documented configuration by using `pubs conf`, and all t
- [Shane Stone](https://github.com/shanewstone)
- [Amlesh Sivanantham](http://github.com/zamlz)
- [DV Klopfenstein](http://github.com/dvklopfenstein)
- [beuerle](https://github.com/beuerle)

@ -12,6 +12,7 @@ import ddt
import certifi
import mock
from pyfakefs.fake_filesystem import FakeFileOpen
import pytest
import dotdot
import fake_env
@ -26,7 +27,7 @@ import fixtures
# makes the tests very noisy
PRINT_OUTPUT = False
PRINT_OUTPUT = True #False
CAPTURE_OUTPUT = True
@ -733,7 +734,7 @@ class TestUsecase(DataCommandTestCase):
def test_first(self):
correct = ['Initializing pubs in /paper_first\n',
'added to pubs:\n[Page99] Page, Lawrence et al. "The PageRank Citation Ranking: Bringing Order to the Web." (1999) \n'
'data/pagerank.pdf was copied to the pubs repository.\n',
'data/pagerank.pdf was copied to /paper_first/doc/Page99.pdf inside the pubs repository.\n',
'[Page99] Page, Lawrence et al. "The PageRank Citation Ranking: Bringing Order to the Web." (1999) [pdf] \n',
'\n',
'',
@ -1085,7 +1086,7 @@ class TestUsecase(DataCommandTestCase):
target_path=os.path.join('data', 'no-ext'))
correct = ['Initializing pubs in /pubs\n',
'added to pubs:\n[Page99] Page, Lawrence et al. "The PageRank Citation Ranking: Bringing Order to the Web." (1999) \n'
'data/no-ext was copied to the pubs repository.\n',
'data/no-ext was copied to /pubs/doc/Page99 inside the pubs repository.\n',
'[Page99] Page, Lawrence et al. "The PageRank Citation Ranking: Bringing Order to the Web." (1999) [NOEXT] \n',
]
cmds = ['pubs init -p /pubs',

Loading…
Cancel
Save